Leighton Clarkson scored in stoppage-time to cap a brilliant Aberdeen comeback at home to Hearts and ease the pressure on manager Barry Robson.
Clarkson tapped in Luis 'Duk' Lopes' cross after 92 minutes to spark wild celebrations in the Aberdeen dugout and eventually clinch an eighth straight home win against Hearts.
The visitors had the lead at the break when Lawrence Shankland headed in Alex Cochrane's corner.
At that point the mood at Pittodrie darkened with Aberdeen having won just three of their 14 league games, and lost 23 in a row after conceding first.
But the players showed they are still fighting for their beleaguered manager after coming out strongly after the break with fresh intensity.The latest Aberdeen newsKeep up to date with Hearts
Jamie McGrath teed up Bojan Miovski to drill in his 12th goal of the season and that only swelled Aberdeen's confidence as they searched for a winner.
Duk came off the bench and made an impact, and it was his pace and composure which set up the winner as he surged away from Kye Rowles and the returning Craig Halkett before crossing for Clarkson to finish.
Hearts had several corners and forced Aberdeen into frantic defending in the final five minutes, but could not find the equaliser and drop two places to fifth as a result.
Aberdeen's second home win of the campaign boosts them to ninth ahead of a big week for the club.
They host Eintracht Frankfurt, who thumped Bayern Munich 5-1 on Saturday, on Thursday in the Europa Conference League before a meeting with Rangers in the League Cup final on Sunday.
Player of the match - Jamie McGrath (Aberdeen)Jack Milne deserves a mention after coming into a high-pressure game and performing well, but Jamie McGrath was brilliant after the break, setting up the equaliser, creating three chances overall and winning the ball back seven times.
Aberdeen show fight for Robson - analysis
This was simply a huge victory for Robson, and the celebrations summed that up.
Though there is no suggestion the hierarchy were reaching for the trigger, many Aberdeen fans felt home defeat by Kilmarnock midweek should be the last straw after a miserable start to the league season.
The doubts about the team - in particular its lack of clear identity and plan domestically - would not have gone away after a meek opening half.
The second half will not have banished them completely either, but the intensity and intent at the very least shows the players are fighting for their manager.
It could be the turning point for them, and if they can get the better of Rangers next week at Hampden their season instantly becomes a success.
Hearts are a curious side. They had won four of their last five games to move up to third without being entirely convincing, but their frailties emerged in the second half as they fell out of the game and lost control of midfield.
As Aberdeen lifted it, Hearts were strangely passive, and their goalscoring struggles are clear. They mustered an expected goals rating of just 0.32, and Shankland has scored more than the rest of his team-mates combined.
Steven Naismith promised attacking football and, although he emphasises that will take time, 15 goals in 16 games will not convince Hearts fans a bright new dawn is around the corner - even if they have improved defensively.
What they said
Aberdeen manager Barry Robson: "It's good to get the three points. We needed it after the last few games.
"It's great spirit from the players. It was never in doubt, they've been in there fighting in a lot of big games and they've never let their heads go down. I'm really pleased for the players and the fans, who have been brilliant."
Hearts manager Steven Naismith: "Extremely disappointed to come away with nothing after how well we started the game.
"It wasn't any tactical that cost us, we got bullied. They started going more direct and making it into a fight and we didn't deal with it anywhere near as well as we should have. The second goal is just extremely poor."
Aberdeen host Eintracht in their final Europa Conference League game (17:45 GMT) before Sunday's League Cup final against Rangers. Hearts visit Celtic Park on Sunday (15:00).
Formation 3-4-1-224Roos2Devlin6GartenmannBooked at 59mins5Jensen28MilneSubstituted forMorrisat 73'minutes10Clarkson4Shinnie17Hayes7McGrathBooked at 78minsSubstituted forMacDonaldat 90+7'minutes9MiovskiBooked at 65minsSubstituted forPolvaraat 77'minutes19SoklerSubstituted forHenriques de Barros Lopesat 73'minutes
Substitutes8Barron11Henriques de Barros Lopes15McGarry20Morris21Polvara23Duncan27MacDonald31Doohan33Rubezic
Formation 3-5-228Clark3Kingsley2KentBooked at 65mins15RowlesBooked at 73mins21SibbickSubstituted forHalkettat 71'minutes8NieuwenhofBooked at 33minsSubstituted forDenholmat 72'minutesBooked at 88mins6BaningimeBooked at 64mins51LowryBooked at 41minsSubstituted forGrantat 58'minutes19Cochrane9ShanklandBooked at 90mins77VargasSubstituted forTagawaat 57'minutes
Match ends, Aberdeen 2, Heart of Midlothian 1.
Second Half ends, Aberdeen 2, Heart of Midlothian 1.
Attempt missed. Craig Halkett (Heart of Midlothian) left footed shot from the centre of the box misses to the left. Assisted by Stephen Kingsley following a corner.
Corner, Heart of Midlothian. Conceded by Nicky Devlin.
Foul by Graeme Shinnie (Aberdeen).
Jorge Grant (Heart of Midlothian) wins a free kick in the defensive half.
Substitution, Aberdeen. Angus MacDonald replaces Jamie McGrath.
Stefan Gartenmann (Aberdeen) wins a free kick in the defensive half.
Foul by Lawrence Shankland (Heart of Midlothian).
Lawrence Shankland (Heart of Midlothian) is shown the yellow card.
Richard Jensen (Aberdeen) wins a free kick in the defensive half.
Foul by Frankie Kent (Heart of Midlothian).
Corner, Heart of Midlothian. Conceded by Jamie McGrath.
Corner, Heart of Midlothian. Conceded by Nicky Devlin.
Goal! Aberdeen 2, Heart of Midlothian 1. Leighton Clarkson (Aberdeen) left footed shot from very close range to the centre of the goal. Assisted by Duk.
Attempt missed. Duk (Aberdeen) header from the centre of the box misses to the left. Assisted by Shayden Morris with a cross.
Hand ball by Stephen Kingsley (Heart of Midlothian).
Aidan Denholm (Heart of Midlothian) is shown the yellow card for a bad foul.
Dante Polvara (Aberdeen) wins a free kick in the defensive half.
Foul by Aidan Denholm (Heart of Midlothian).
Player of the match
with an average of 7.01
Squad number9Player nameMiovski
Squad number27Player nameMacDonald
Squad number2Player nameDevlin
Squad number7Player nameMcGrath
Squad number21Player namePolvara
Squad number5Player nameJensen
Squad number11Player nameDuk
Squad number6Player nameGartenmann
Squad number28Player nameMilne
Squad number17Player nameHayes
Squad number24Player nameRoos
Squad number19Player nameSokler
Squad number10Player nameClarkson
Squad number20Player nameMorris
Squad number4Player nameShinnie
Heart of Midlothian
Squad number9Player nameShankland
Squad number19Player nameCochrane
Squad number2Player nameKent
Squad number28Player nameClark
Squad number3Player nameKingsley
Squad number15Player nameRowles
Squad number77Player nameVargas
Squad number6Player nameBaningime
Squad number8Player nameNieuwenhof
Squad number21Player nameSibbick
Squad number51Player nameLowry
Squad number4Player nameHalkett
Squad number7Player nameGrant
Squad number22Player nameDenholm
Squad number30Player nameTagawa