Aberdeen saw their lead at the top of the Scottish Premiership reduced to just two points, but were in the end thankful for Ryan Jack's late leveller to avoid defeat against a spirited Dundee. The Dons had looked comfortable after David Goodwillie's early strike put them in front, but goals from Gary Irvine and Greg Stewart had Dundee in front by half-time.
Gary Harkins added a third soon after the interval to put daylight between the sides. Aberdeen were handed a late lifeline through a Jonny Hayes penalty, and Jack sealed a share of the points when he bundled home deep in injury time to rescue a 3-3 draw.
High on confidence going into the match, the home side had already threatened through Mark Reynolds before they took the lead after just seven minutes. Niall McGinn strode forward and steered a pass into the path of Adam Rooney who had pulled out into the right channel. He slid a sweet ball across the six-yard box, and Goodwillie was perfectly placed to power high past former Dons goalkeeper Scott Bain.
The Dons should have doubled their advantage after 21 minutes. Peter Pawlett sparked a move that saw Goodwillie pick out Hayes with a low cross. The Irishman saw his shot blocked, and when the rebound fell to Rooney, you would have put your mortgage on the net bulging rather than the former Birmingham City man blasting wide.
The home side continued to press but their long run without conceding - which had stretched to eight matches - was finally ended seven minutes from the interval. Just as Dundee themselves had been undone by a swift counter-attack, they proved they were capable of meting out the same punishment.
Shay Logan failed to close down Stewart on the left, and following a neat interchange of passes on the edge of the area, Harkins laid off for Irvine to blast home the equaliser. And like a bolt from the blue, Paul Hartley's men turned the game on its head just two minutes later. Stewart this time got his name on the scoresheet. Having cut in from the left before exchanging passes with Luka Tankulic, he drilled a low shot into the far corner to give Dundee the lead.
Incredibly, that lead was extended just three minutes after the interval. The Aberdeen defence still looked stunned as they failed to clear a free-kick from the Dundee left, and Harkins was able to send a crisp volley home from just inside the area.
As if things were not bad enough for Aberdeen, the increasingly influential defender, Ash Taylor, was forced off through injury on the hour. He was replaced by Willo Flood as Aberdeen shuffled their pack, while Cammy Smith took the place of Pawlett at the same time. It was unusually scrappy from Derek McInnes' side, but Dundee were happy to impose themselves physically and prevent the Dons from playing their normal possession game.
As a result, Aberdeen tried to force the ball forward and conversely made things easier for Dundee, whose defence stood up to the challenge well. Until, that is, substitute Lawrence Shankland was felled three minutes from time, and referee Alan Muir pointed to the spot.
Hayes stepped up to find the bottom corner despite the despairing grasp of Bain. That was not the end of the drama, though, and the home fans went from despair to jubilation as Jack forced home from close range to grab a point that looked unlikely just five minutes before.