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.
- 45 Simonsen
- 03 Lockwood (Conroy - 46' Booked )
- 17 Benedictus
- 18 Gallagher
- 25 Toshney
- 26 Easton
- 06 Davidson (Nish - 62' )
- 08 McBride
- 09 Finnigan
- 10 Baird (Riley - 66' Dismissed )
- 20 McAlister
- 36 Baird
- 02 Irvine
- 07 Riley
- 11 Conroy
- 28 Kerr
- 24 Nish
- 47 Barrowman
Heart of Midlothian
- 01 MacDonald
- 05 Barr
- 06 Webster Dismissed after an earlier booking
- 29 McHattie
- 02 Hamill Booked
- 07 Stevenson
- 14 Walker (Carrick - 47' )
- 15 Holt (B King - 83' )
- 19 McGowan
- 09 Sutton
- 21 Ngoo (Taouil - 32' Booked )
- 13 Ridgers
- 28 McKay
- 10 Taouil
- 27 Tapping
- 17 Smith
- 32 B King
- 37 Carrick
Live Text Commentary
Full Time The final whistle goes and the game is over.89:25 Booking
Booking Ryan Conroy is cautioned by the ref for unsporting behaviour.88:36 Dismissal
Dismissal Nicky Riley receives a red card.85:51
Brian Easton gives away a free kick for an unfair challenge on Billy King. Jamie Hamill takes the free kick.84:57
Free kick awarded for a foul by Darren Barr on Colin Nish. Direct free kick taken by Ryan Conroy.82:40 Substitution
Substitution Billy King comes on in place of Jason Holt.82:13
Foul by Declan Gallagher on John Sutton, free kick awarded. Kevin McHattie takes the direct free kick.81:05 Goal scored
Goal! - Ryan Conroy - Dundee 1 - 0 Hearts Free kick scored by Ryan Conroy from long range to the bottom left corner of the goal. Dundee 1-0 Hearts.80:23
Ryan Stevenson challenges James McAlister unfairly and gives away a free kick.76:21
Corner taken by Ryan Conroy from the left by-line.75:51
Inswinging corner taken left-footed by Ryan Conroy from the right by-line.68:27
James McAlister gives away a free kick for an unfair challenge on Ryan Stevenson. Kevin McHattie restarts play with the free kick.67:52
Ryan Conroy takes a long range shot clearing the bar.66:42
Unfair challenge on Ryan Conroy by Jamie Hamill results in a free kick. Kyle Benedictus restarts play with the free kick.66:42 Booking
Booking Jamie Hamill receives a caution.65:39 Substitution
Substitution Nicky Riley on for John Baird.62:52
Inswinging corner taken from the right by-line by Ryan Conroy.61:39 Substitution
Substitution Iain Davidson leaves the field to be replaced by Colin Nish.56:53 Booking
Booking The referee books Mehdi Taouil for unsporting behaviour.53:09
Inswinging corner taken from the right by-line by Kevin McHattie, save by Steve Simonsen.
Corner taken by Ryan Conroy, Brian Easton takes a shot.46:39 Substitution
Substitution Dale Carrick joins the action as a substitute, replacing Jamie Walker.45:53 Substitution
Substitution Ryan Conroy comes on in place of Matthew Lockwood.45:01
The referee starts the second half.45:00 +2:20 Half time
Half Time The ref blows to end the first period.45:00 +1:38
Corner from the left by-line taken by Jamie Walker, clearance by Iain Davidson.45:00 +0:46
Darren Barr gives away a free kick for an unfair challenge on John Baird. Matthew Lockwood restarts play with the free kick.43:08
Declan Gallagher fouled by John Sutton, the ref awards a free kick. Declan Gallagher restarts play with the free kick.41:17
The referee blows for offside against Carl Finnigan. Jamie MacDonald takes the direct free kick.38:56
Free kick awarded for a foul by Kevin McBride on Jamie Walker. Kevin McHattie restarts play with the free kick.35:36
Corner taken by Matthew Lockwood, clearance made by Kevin McHattie.31:15 Substitution
Substitution Mehdi Taouil replaces Michael Ngoo.30:46
Inswinging corner taken from the left by-line by James McAlister, save by Jamie MacDonald.29:10
Lewis Toshney is caught offside. Free kick taken by Jamie MacDonald. Corner taken left-footed by Matthew Lockwood.28:19
The assistant referee signals for offside against Iain Davidson. Jamie MacDonald takes the free kick.27:12 Dismissal
Dismissal Andy Webster is sent off.26:12
Free kick awarded for an unfair challenge on Carl Finnigan by Andy Webster. Matthew Lockwood takes the free kick.22:58
Jamie Walker fouled by Lewis Toshney, the ref awards a free kick. Kevin McHattie takes the free kick.18:03
Corner taken right-footed by Matthew Lockwood from the left by-line, Jamie MacDonald makes a clearance.17:28
James McAlister fouled by Andy Webster, the ref awards a free kick. Kyle Benedictus shoots direct from the free kick, save by Jamie MacDonald.17:10 Booking
Booking Andy Webster receives a yellow card for unsporting behaviour.15:49
Jamie Hamill gives away a free kick for an unfair challenge on John Baird. Kevin McBride restarts play with the free kick.14:50
Inswinging corner taken by Matthew Lockwood from the right by-line.13:14
Inswinging corner taken left-footed by Matthew Lockwood played to the near post.12:15
Foul by Dylan McGowan on Kyle Benedictus, free kick awarded. Steve Simonsen restarts play with the free kick.11:41
Corner taken by Jamie Walker from the left by-line.10:24
Kevin McHattie fouled by Carl Finnigan, the ref awards a free kick. Kevin McHattie restarts play with the free kick.9:14
Jamie Walker takes the inswinging corner, Matthew Lockwood manages to make a clearance.8:45
Jamie Hamill takes a shot. Save by Steve Simonsen.7:48
Jason Holt fouled by Kyle Benedictus, the ref awards a free kick. Ryan Stevenson takes the free kick.6:34
John Baird is flagged offside by the assistant referee. Jamie MacDonald restarts play with the free kick.0:00
The game kicks-off.
Live data and text provided by our data suppliers