Match ends, Hearts 1, Aberdeen 1.
Jamie Hamill's penalty rescued a point for 10-man Hearts against Aberdeen, and delayed relegation to the Championship for at least another few days.
The Tynecastle side had matched the visitors but when Danny Wilson was sent off for a second yellow card there looked likely to be only one outcome.
Willo Flood fired the resulting free-kick into the bottom corner.
But Hearts roared back when Shaleum Logan fouled Callum Paterson inside the area and Hamill fired home.
The gap between bottom side Hearts, who started the season with a 15-point deduction for being in administration, and St Mirren now stands at 18 points with six matches to play.
Hearts visit Partick Thistle on Saturday and anything less than a win will confirm demotion for Gary Locke's side, an outcome that would also be confirmed if St Mirren avoid defeat against Motherwell.
Aberdeen reclaim second place in the Scottish Premiership but are only ahead of Motherwell on goal difference.
The Dons top scorer Niall McGinn, buoyed by his first goal in three months in Saturday's 1-1 with Dundee United, started the game with a spring in his step and tested Jamie MacDonald with an early chance.
That was the only shot on target the Hearts goalkeeper had to deal with for some time, despite the best efforts of the returning Peter Pawlett, who was proving to be a handful.
The visitors slowly began to take control with three good chances in a dominant five-minute spell.
Adam Rooney was first to be denied by MacDonald from close range before the Irish striker's knock-down opened up the opportunity for Pawlett, a shot which was deflected over.
McGinn's free-kick hit the wall, but the rebound fell to him and his second effort was better, just whistling past.
Ryan Stevenson headed a free-kick wide as the home side tried their luck at the other end, and they started the second half as the better team after manager Locke switched Paul McCallum for Scott Robinson.
David Smith and Sam Nicholson were looking dangerous in particular, and the home side also managed to quieten the threat of Pawlett, who was eventually hooked.
MacDonald had to be sharp off his line though to deny Rooney after good work from Ryan Jack, then Paterson had to block Barry Robson's shot.
Back came the hosts. Paterson hit a powerful shot which Langfield had to tip wide, but Aberdeen bared their teeth again when Rooney sent an overhead kick over the bar.
Just as Hearts looked like they were Aberdeen's equal, their plans were thrown into disarray when Wilson was given a second yellow card for hauling back Rooney.
They had no time to re-adjust, with Flood guiding the free-kick into the net to give the Dons the lead.
Hearts could have drawn themselves level when the ball fell invitingly to Stevenson after a rare error from Mark Reynolds, but he blasted his shot over.
However, they were handed a lifeline when Logan brought down Paterson.
With relegation minutes from being confirmed, Hamill stepped up and drove home the penalty to send Tynecastle wild.
Aberdeen attempted a late rally and McGinn twice sent shots wide, but Hearts deservedly hung on to remain unbeaten at home against the Dons since 2010.
- 4WilsonBooked at 73mins
- 17SmithBooked at 57minsSubstituted forKingat 69'minutes
- 9McCallumBooked at 45minsSubstituted forRobinsonat 45'minutes
- 28NicholsonSubstituted forMcKayat 73'minutes
- 29LoganBooked at 87mins
- 15RobsonSubstituted forSmithat 70'minutes
- 22JackBooked at 26mins
- 16PawlettBooked at 75minsSubstituted forVernonat 78'minutes
- Kevin Clancy
- Shots on Target
Second Half ends, Hearts 1, Aberdeen 1.
Russell Anderson (Aberdeen) wins a free kick in the attacking half.
Foul by Brad McKay (Hearts).
Foul by Russell Anderson (Aberdeen).
Ryan Stevenson (Hearts) wins a free kick on the left wing.
Attempt missed. Niall McGinn (Aberdeen) right footed shot from the centre of the box is close, but misses to the right.
Attempt missed. Niall McGinn (Aberdeen) left footed shot from outside the box misses to the right.
Goal! Hearts 1, Aberdeen 1. Jamie Hamill (Hearts) converts the penalty with a right footed shot to the bottom left corner.
Shaleum Logan (Aberdeen) is shown the yellow card.
Penalty conceded by Shaleum Logan (Aberdeen) after a foul in the penalty area.
Penalty Hearts. Callum Paterson draws a foul in the penalty area.
Foul by Scott Vernon (Aberdeen).
Jamie Hamill (Hearts) wins a free kick on the left wing.
Attempt missed. Ryan Stevenson (Hearts) right footed shot from the centre of the box misses to the left.
Attempt missed. Adam Rooney (Aberdeen) header from the right side of the six yard box is high and wide to the right following a set piece situation.
Cameron Smith (Aberdeen) wins a free kick on the right wing.
Foul by Kevin McHattie (Hearts).
Substitution, Aberdeen. Scott Vernon replaces Peter Pawlett.
Foul by Niall McGinn (Aberdeen).