Dundee were seconds from a humiliating cup exit at the hands of Lowland League Bonnyrigg Rose before coming from behind in extra time to win 3-2 in a pulsating tie.
Finally an Osman Sow strike after 111 minutes saw the Dark Blues into round three of the Scottish Cup after an impressive showing from Robbie Horn’s gutsy Rose side.
A first-half Lee Currie penalty looked to have earned the minnows a famous victory with goalkeeper Mark Weir in fine form.
However, substitute Jonathan Afolabi popped up in the 93rd-minute to force extra-time.
Another Currie spot-kick incredibly put the Rosey Posey back in front in extra-time before Lee Ashcroft and Sow turned things around and spared the Dee’s blushes.
Dundee were forced into two changes to their starting line-up through knocks picked up by Jordan McGhee and Christie Elliott in the win over Hearts last week. Incoming were Jordon Forster, for his first start since October, and Fin Robertson.
Also missing were housemates Cammy Kerr and Declan McDaid after the news of a positive Covid-19 test at the club yesterday. That saw Ashcroft step into the right-back role.
Bonnyrigg, meanwhile, had a former Deefiant Dee skippering them with Jonny Stewart returning to his former club.
The home side had an early opportunity for Sow blocked but it was the underdogs who created the big chance early on.
The ball was dropped in behind the home defence and George Hunter raced onto the ball, firing towards the corner but he was denied by a superb stop from Dundee goalie Jack Hamilton.
The Lowland League side continued to look the more dangerous in attack and made that count after 24 minutes as the referee pointed to the spot, much to the dismay of the Dark Blues.
Forster was the man penalised for bringing down Dean Hoskins in the area, giving Lee Currie – who scored a hat-trick of penalties in the first round – the chance from 12 yards which he took with aplomb.
Finally Dundee tested Rose keeper Weir five minutes before the break as Charlie Adam smashed a fierce drive goalwards but saw his effort beaten out.
The Dark Blues upped their game immediately after the restart with Mullen bringing a good low save out of Weir. That was to be the story for much of the second period.
Bonnyrigg were camped in their own half but continued to hold firm with Sow next to miss a decent chance, heading over from six yards on 63 minutes.
With 18 minutes to go Sow tested Weir from 20 yards before the Rose No 1 kept out a close-range Paul McGowan header.
With 10 to go the crossbar came to Rose’s rescue as Neil Martynuik skewed a clearance towards his own goal only to be relieved as the ball cannoned back off the woodwork.
In stoppage time Weir pulled off a top-class save to keep out a goal-bound Ashcroft header before Liam Fontaine saw another header cleared off the line as it looked like the home side were heading out.
Finally the pressure told with 93 minutes on the clock, however, as Weir pulled off yet another wonder save to keep out a Sow header before substitute Afolabi forced the ball over the line.
The visitors showed more ambition in extra time and almost re-took the lead as Kerr Young saw a header cleared off the line by Adam.
They did remarkably go back in front seconds before the break through another debatable penalty as Ross Gray hit the deck under Jordan Marshall’s challenge.
Once more Currie stepped up and made no mistake from 12 yards.
Dundee didn’t wait too long to level things up this time with Ashcroft rising highest from an Adam corner to nod in for 2-2 with 110 minutes on the clock.
And they took the lead for the first time in the game with nine minutes to go as Sow followed up yet another Weir save, this time from Mullen, to knock into an empty net.
The Dark Blues should have wrapped up victory with three minutes remaining but Afolabi put a Marshall cross wide from yards out.
After that the referee brought an end to a pulsating cup tie that saw Dundee relieved to get through after denying Bonnyrigg a famous victory by the skin of their teeth.
Dundee: J Hamilton, Ashcroft, Fontaine, Forster, Marshall, Byrne (Anderson 71), Robertson (Afolabi 56), Adam, McGowan, Mullen (Moore 120), Sow.
Subs not used: Ferrie, N Hamilton, D Strachan, Murray.
Bonnyrigg Rose: Weir, Brett, Young, Horne, Martynuik, Hoskins, Stewart (Turner 74), Currie, S Gray (Barrett 101), Hunter (R Gray), McGachie. (Wilson 87)
Subs not used: Andrews, Mair, Docherty, Barrett.