The battle for automatic promotion from the Scottish Championship was perfectly poised heading into the final day of the campaign, with the top two going head to head in a winner-takes-all showdown.
Dundee went into the contest with a two-point lead and knowing that they simply needed to avoid defeat to secure an immediate return to the top flight, after Queen's Park had picked up only four points from the last 18 on offer to see a first-placed finish slip out of their grasp.
However, victory on home turf on the final day would have seen Scotland's oldest club earn a third successive promotion and put them back in the top flight for the first time since 1957-58.
The contest more than lived up to the pre-match billing too, with Dundee eventually edging an eight-goal classic which swung both ways and saw both teams squander leads in a topsy-turvy first half that ended 3-3.
The visitors made a perfect start when Alex Jakubiak opened the scoring after only four minutes, but Queen's Park turned things around by the 12th minute courtesy of quickfire goals from Charlie Fox and Connor Shields.
Queen's Park were only ahead for five minutes themselves, though, with Dundee levelling things up again through Lee Ashcroft to make it 2-2 after only 17 minutes.
The contest then swung back in favour of the visitors as Zach Robinson put them in front once again after 34 minutes, but there was still time for one final twist in a remarkable first half as Fox got his second of the game to make it 3-3 just before the interval.
However, Dundee produced a more professional and controlled second-half display to close the floodgates while adding two more goals themselves.
Lyall Cameron's 54th-minute goal put them ahead for the third time on the night, although given the way the match had gone to that point, it was not until Luke McCowan made it 5-3 with nine minutes remaining that the promotion party could really begin with any level of confidence.
The result means that Owen Coyle's Queen's Park will have to negotiate the playoffs if they are to continue their fairytale rise up the divisions and play top-flight football for the first time in 65 years next season.
Queen's Park end the season in third place having been leapfrogged by Ayr United into second on the final day, with Partick Thistle completing the playoff picture.
Meanwhile at the other end of the table, Cove Rangers were beaten 2-1 at home by Greenock Morton which, coupled with Hamilton's goalless draw against Arbroath, condemns Cove Rangers to relegation.