Ross County climbed within two points of the Scottish Premiership top six - and five clear of second-bottom Dundee - with their first home win since November.
Simon Murray bent the visitors ahead just four minutes in with a terrific swerving strike from the left angle of the box, swooping high beyond Jordan Amissah.
County soon rallied, though, and after George Harmon, Ronan Hale and Connor Randall went close, Kieran Phillips knocked home the leveller.
The January signing forced into an empty net after a teasing Harmon delivery was nodded back across the face of goal by Kacper Lopata.
County emerged from half-time with ruthless intent, stunning Dundee with two goals in the first four minutes of the new half.
Hale spurned a brilliant chance from close range, but from the corner which followed, Akil Wright sent an outrageous scissor kick into the away net.
Two minutes later, Dundee were reeling again; Hale springing Phillips down the right and he squared for Noah Chilvers to bullet home first-time, marking his 24th birthday with a goal.
Dundee toiled bravely, shelling the home box with an array of crosses, chips and deliveries, but failed to find the clinical touch to prevent a fourth league loss on the bounce. Jordan McGhee spurned a glorious stoppage-time header which might have thrown them a lifelie.
Tony Docherty's team remain six points above basement club St Johnstone, who face Hearts on Sunday.