Jordan McGhee’s 90th-minute header completed a Tayside turnaround for Dundee as they saw off St Johnstone 2-1 at Dens Park.
VAR came to their rescue this time after some high-profile gripes with the technology with Luke McCowan’s penalty levelling matters on 75 minutes.
That was after a dangerous Saints side led for the majority of the contest thanks to Matt Smith’s opener after nine minutes.
But it was Tony Docherty’s side who came away from the end-to-end contest with all three points.
Between the two sides there were 10 changes in total, five apiece.
Kerr Smith and Adama Sidibeh were both in to make their first St Johnstone starts as Ryan McGowan, Max Kucheriavyi, Connor Smith, Tony Gallacher and Fran Franczak dropped out.
Dundee had one just one of the past 11 meetings between the sides but were also unbeaten in the last four with three draws and a 1-0 victory in December 2021.
And it was the Perth Saints who took the early lead, scoring from their first attack. A nice move down the right eventually saw Graham Carey lay the ball to Matt Smith on the edge of the area.
The Welshman showed real composure to find the bottom corner.
The Dark Blues had enjoyed the majority of the play up to that point but were missing a cutting edge and that’s how the rest of the half went.
They went close on 23 minutes when Carey headed a Donnelly header off the line and tested Dimitar Mitov on a couple of occasions.
But it was the visitors who looked the more dangerous. Happy to defend their lead and hit on the break, the pace of Sidibeh and Benjamin Kimpioka caused real problems.
Both had good chances before the break with Kimpioka bringing a good save from Trevor Carson.
Dundee emerged from half-time with renewed purpose, substitute Dara Costelloe bringing energy to the right flank and boos from the away end.
But Saints were still proving effective at the other end with Carson needing to be at his best to deny Sidibeh a superb overhead kick on the hour mark.
And from the resulting corner, Andy Considine headed onto the crossbar.
Five minutes later a Donnelly cross found Shaughnessy’s head but the Dundee skipper headed wide.
The Dark Blues were toiling against a well-drilled defence with a lead to hold onto.
But then came a VAR check – and this time it went Dundee’s way. Referee David Munro went to the monitor and ruled that Liam Gordon had fouled Bakayoko in the area. Penalty Dundee.
Up stepped McCowan to fire his side level, his strike clipping the post on its way in.
Beck flashed a fierce ball across goal before Bakayoko saw an effort saved by Mitov at the back post as Dundee looked to complete the turnaround.
Saints too had their moments to go for the win but it was the home side who grabbed the crucial third goal.
Beck found space in the middle of the park and clipped a cross onto the head of McGhee who planted his header into the corner.
But the visitors weren’t done yet as Carson palmed out a chipped Luke Robinson effort in stoppage-time.
The final whistle was delayed after a concerning head injury sustained by Michael Mellon with the Burnley man stretchered off.
When it came, victory saw Dundee move five points ahead of their Tayside neighbours and clear in sixth place.
Dundee Star Man: Jordan McGhee
Dundee’s Mr Versatile has been in fine form of late, even if results haven’t been coming for the Dee.
This was McGhee’s third goal in six games and his most crucial of the season so far.
St Johnstone Star Man: Matt Smith
Not only did the Welsh international score his first goal for St Johnstone he also barely misplaced a pass in the whole game.
After sitting out a couple of game through injury, Smith picked up where he left off.
Dundee FC: Carson 7, McGhee 8, Shaughnessy 7, Donnelly 7 (Lamie 89), Beck 7, Sylla 7, Cameron 6, McCowan 7, Tiffoney 6 (Mellon 67, 6 (Ashcroft 90)), Robinson 5 (Costelloe 46, 6), Bakayoko 7.
Subs not used: Sharp, Dodgson, Astley, Ashcroft, Mulligan, Robertson.
St Johnstone: Mitov 7, Considine 7, Gordon 7, Carey 7, Sidibeh 7.5, Olufunwa 6.5 (Kucheriavyi, 58), Robinson 6, M Smith 8 (Jaiyesimi 90), Kimpioka 6.5 (C Smith, 58), Keltjens 6 (McGowan, 79), K Smith 6 (Sprangler, 70).
Subs not used: Richards, Gallacher, Kane, Clark.
Referee: David Munro
Attendance: 7,102 (1,681 away)