Bottom side Dundee kept alive their hopes of avoiding relegation from the Scottish Premier League thanks to Ryan Conroy's winner against Hearts.
Hearts were reduced to 10 men after 28 minutes when Scotland defender Andy Webster was shown a second yellow card.
Brian Easton sent a header against the woodwork before Conroy's thunderous 40-yard free-kick deflected past goalkeeper Jamie MacDonald.
Dundee's Nicky Riley was sent off a minute before normal time.
But the Dens Park side retained their lead and, with St Mirren being held to a 3-3 draw away to Hibernian, it means that Dundee's battle for survival continues until next weekend at least.
Their third straight victory means they are now only eight points behind the Buddies with three games remaining.
Hearts had started more sharply and Steve Simonsen was tested early with a Jamie Hamill free-kick that the Dundee goalkeeper gathered at the second attempt.
Dundee replied through Kyle Benedictus with a 35-yard blast from a free-kick forcing a flying save from MacDonald at his left side.
Hearts were reduced to 10 men when Webster's head clash with Carl Finnigan resulted in a second yellow card and an ordering off.
A Jim McAlister header was well saved by the Hearts goalkeeper just after the half hour and, into the restart, Easton's header cracked off the visitors bar.
Hearts were still pressing strongly despite their one-man disadvantage.
However, with 11 minutes remaining, Dundee stunned them with the winning goal.
A free kick awarded 40 yards out and facing straight on to goal seemed an impossible shot.
Conroy thought otherwise and sent a drilling drive goalwards. It took a wicked deflection and flew past MacDonald to bustle in the net.
Dens Park erupted in the knowledge that, with St Mirren drawing at Easter Road, Dundee's SPL survival hopes may still be slim but not impossible.