Kilmarnock slipped to the foot of the Scottish Premiership after Ashley Hay's towering header and slapstick second earned Dundee their fifth win of the season.
An open encounter was settled by Hay in the final 10 minutes - after the forward himself had an effort disallowed - to ensure Steven Pressley's side clambered above their city rivals and into fourth place.
Joe Bevan - a terrific threat on the right of attack - shattered the deadlock when he latched on to a searing Ethan Hamilton run and through ball, chopped onto his left foot and swept beyond Nico Mantl.
The German goalkeeper making his Kilmarnock debut had already denied Bradley Fink, whose close-range header should have found the net, before the striker bundled the rebound off a post.
Mantl would have a painful part to play at the death.
Long before the chaotic finale, on the stroke of half-time, he was rendered helpless by the shoddy marking in front of him when Hamilton steamed unguarded into the box from a corner but side-footed over from six yards on the volley.
Kilmarnock saw first-half glimpses through Greg Kiltie and Joe Hugill, and the latter drew a phenomenal stop from Owen Goodman early in the second period.
Kiltie lofted the ball over the top for the striker, who set himself, and unleashed from 12 yards. But Goodman leapt to his right and tipped over the top.
Hugill would have his moment, however, converting from the spot after George Stanger hit the deck from a Kilmarnock corner.
But Dundee regrouped and went again, Hay diverting home with his left arm after Cathal McCarthy had completely misread the flight of a cross. The defender's blushes were spared by the VAR officials.
Hay was unperturbed, soaring into the Dundee night to power home a header with seven minutes to play.
As if to underscore the problems besieging Neil McCann at the back, his new keeper went walkabout in the dying embers allowing Hay to saunter into the box and slot into an empty net. When it rains, it pours.