A 74th-minute free-kick from Willo Flood looked to have sealed the fate of Gary Locke's side, who had already seen captain Danny Wilson sent off.
MORE: UEFA Champions League: Real Madrid dominate Dortmund | UEFA Champions League: Paris Saint-Germain too good for Chelsea
But with three minutes left Shaleum Logan fouled Callum Paterson in the area, giving Jamie Hamill the chance to convert from the penalty spot and keep Hearts up - for a few more days at least.
The financially-stricken club were this week revealed to be at their "lowest ebb" by administrators, who admit that the threat of liquidation is a very real one if delays over the transfer of shares from majority owners UBIG to a fans group are not resolved.
On the pitch, it has been a season of similar turmoil, with Hearts having started the campaign on -15 points as a result of their money worries and having failed in their bid to play catch-up ever since.
A rare victory over Edinburgh rivals Hibernian on Sunday had seen them avoid the drop, and they showed similar resolve to keep high-flying Aberdeen at bay for long spells.
The turning point looked to have come with the dismissal of Wilson 18 minutes from time for a second yellow card, after he had pulled back Adam Rooney.
From the resulting free-kick, Flood fired home his third goal of the season.
But when Paterson was upended in the box late on, the referee pointed to the spot and Hamill kept his nerve.
The result looks unlikely to alter the course of Hearts' season, with Locke's side now 18 points from safety with six games left - they will be relegated if St Mirren take anything from Saturday's home game against Motherwell.
Aberdeen, meanwhile, are back up to second after stretching their unbeaten run to eight games in all competitions.