Carl Finnigan's late winner against St Mirren was enough to preserve Dundee's Clydesdale Bank Premier League survival aspirations for another week.
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.
Why are you making commenting on The Herald only available to subscribers?
It should have been a safe space for informed debate, somewhere for readers to discuss issues around the biggest stories of the day, but all too often the below the line comments on most websites have become bogged down by off-topic discussions and abuse.
heraldscotland.com is tackling this problem by allowing only subscribers to comment.
We are doing this to improve the experience for our loyal readers and we believe it will reduce the ability of trolls and troublemakers, who occasionally find their way onto our site, to abuse our journalists and readers. We also hope it will help the comments section fulfil its promise as a part of Scotland's conversation with itself.
We are lucky at The Herald. We are read by an informed, educated readership who can add their knowledge and insights to our stories.
That is invaluable.
We are making the subscriber-only change to support our valued readers, who tell us they don't want the site cluttered up with irrelevant comments, untruths and abuse.
In the past, the journalist’s job was to collect and distribute information to the audience. Technology means that readers can shape a discussion. We look forward to hearing from you on heraldscotland.com
Comments & Moderation
Readers’ comments: You are personally liable for the content of any comments you upload to this website, so please act responsibly. We do not pre-moderate or monitor readers’ comments appearing on our websites, but we do post-moderate in response to complaints we receive or otherwise when a potential problem comes to our attention. You can make a complaint by using the ‘report this post’ link . We may then apply our discretion under the user terms to amend or delete comments.
Post moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours.
Read the rules hereComments are closed on this article