Carl Finnigan's late winner against St Mirren was enough to preserve Dundee's Clydesdale Bank Premier League survival aspirations for another week.
- Related Content
John Brown's side arrived in Paisley 13 points behind their opponents with five games to play but got the win that kept them up for now.
Jim McAlister had smashed the visitors ahead only for Saints' top scorer Steven Thompson to level just after the interval.
But with time running out, substitute Finnigan squeezed a header down off the underside of the bar and just over the line to ensure their battle against relegation continued to next week's home fixture with Hearts.
Saints had looked set to push on for a winner themselves before captain Jim Goodwin's dismissal for two bookable offences swung the game away from them.
St Mirren's build-up had centred on chairman Stewart Gilmour's decision to join with Ross County chief Roy MacGregor to sink league reconstruction talks as they paired up to defeat the bid for a 12-12-18 set-up.
That led to stinging rebukes from the likes of Aberdeen chairman Stewart Milne and Hearts chief executive David Southern, but the Saints' fans rose on eight minutes to show their support for Gilmour and his seven boardroom colleagues.
On the pitch, the home team came close to raising a second round of applause as Gary Teale's clever corner routine set up Thompson to clip a shot to the front post but Matt Lockwood headed clear.
It was another Teale corner that brought about the next shot on target on 16 minutes as the former Scotland winger - this week rewarded with a new one-year contract extension - picked out left-back Paul Dummett but the on-loan Newcastle man's header was straight at Steve Simonsen.
Dundee had sniffed around Craig Samson's net a couple of times themselves but the first to call the keeper into action was Kyle Benedictus. His 25-yard free-kick beat the wall, but not the Saints number one.
The set-piece was straight down Samson's throat but McAlister had the stopper diving to his left on 23 minutes with a shot on the turn while Kevin McBride then lashed a dipping volley off the bar from the loose ball that followed.
St Mirren lost Paul McGowan to injury soon after, replacing the playmaker with 18-year-old midfielder John McGinn who immediately introduced himself with a delightful pivot to evade Lockwood and Brian Easton. His cross from Thompson was perfect but the striker miscued as he was left swinging at fresh air 12 yards out.
But McAlister made no mistake five minutes from half-time as he put Dundee ahead. Marc McAusland misjudged a high ball and that allowed John Baird to prod past Goodwin and into the path of McAlister, who smashed home the bouncing ball from 15 yards.
The visitors' lead was wiped out within seven minutes of the restart, though. Having come close with a couple of corner routines in the first half, Teale came good with his third as he flighted the ball to the back post for Thompson to thunder home his 16th goal of the season.
A second for the hosts should have arrived 10 minutes later as Dummett and Graham Carey combined to tee up McGinn at the back post. But Simonsen saved his header with a brave block before Lewis Guy put the rebound over the top.
The home side's task got all the harder as Goodwin collected his second yellow card. The Irishman had clattered into Finnigan down in the left-hand corner just moments after his 59th-minute introduction, earning himself a caution, only to pick up a second with another barge on the striker six minutes later.
The dismissal only spurred on Dundee to go in search of the goal that would maintain their survival hopes for another week. Gary Harkins squeezed past McAusland on 77 minutes but sent his shot into the side-netting, and Easton smashed a left-footed shot off the post moments after.
But, just as desperation was about to set in, Harkins squeezed himself to the byline and cut a cross to the back post for Finnigan to smash a header off the underside off the bar and over the line. Samson claimed he had grasped it before the whole ball had crossed, but referee Craig Thompson awarded the goal after checking with his assistant to send the relieved travelling support into raptures.