Match ends, Heart of Midlothian 2, Aberdeen 1.
Uche Ikpeazu scored the winner as Hearts produced a stunning second-half fight-back to beat Aberdeen and secure a top-six finish in the Scottish Premiership.
The striker capitalised on sloppy defending to fire home, taking Hearts two points above city rivals Hibernian.
Connor McLennan had edged the visitors ahead, forcing in after Sam Cosgrove's header crashed off the bar.
But Sean Clare levelled after Jake Mulraney was felled by Andy Considine.
Cosgrove had gone close to making it 2-0 to Aberdeen in the first half, before Ikpeazu missed a glorious chance to square it at 1-1 after the break.
Aberdeen, who suffered their first away defeat in 10 matches, drop to fourth following a victory for Steve Clarke's Kilmarnock.
Hosts a different side after break
Hearts set up with wingbacks but rather than go wide they opted for a far more direct approach, with Ikpeazu the inevitable target.
The big striker had an early effort saved by Joe Lewis before the away side took control, and soon the lead. From a Niall McGinn corner, Cosgrove rattled the bar with a header and McLennan was there to knock the ball in from close range.
Graeme Shinnie was a huge presence for the dominant visitors in the middle of the park and he fired a shot wide before Cosgrove had a looping header tipped over by Zdenek Zlamal.
Hearts had been poor, but at the start of the second half they had a huge chance. Jamie Brandon nipped in front of Lewis to win the ball at the edge of the box but, with the net empty, Ikpeazu somehow fired wide after the ball fell perfectly into his path.
The much-improved hosts equalised from the penalty spot after Mulraney was downed by Considine following an excellent burst forward. Up stepped Clare and the Englishman fired into the net.
Ikpeazu then went down under a challenge from Lewis, but referee John Beaton decided the striker had dived and brandished a yellow card. The Hearts forward was left in disbelief and replays showed he had a strong case.
Hearts continued to dial up the pressure and almost went ahead through Craig Wighton, but he could not sort his feet out six yards from goal and the ball was hacked clear.
But the hosts soon hammered home their second-half dominance. Ikpeazu powered his way into the box, leaving Considine and Scott McKenna in his wake, and picked his spot beyond Lewis to make it 2-1.
Seconds later Ikpeazu would be off, subbed after a head-knock following a collision. He was taken up the tunnel on a stretcher to rapturous acclaim from the home fans.
Hearts rewarded for raising game - analysis
It was classic Jekyll and Hyde from Hearts. A poor first half was followed by an excellent second and in the end a deserved win. They had so many opportunities and, for a while, it looked like they might rue missed chances, but a top-six finish is now secured.
Two big matches loom for Hearts in the coming week - first Rangers away on Wednesday, then the derby with Hibs at Tynecastle next Saturday.
No doubt Aberdeen were the better side in the first half, with McLennan underlining how big a talent he is. The fantastic Aberdeen away record had to come to an end at some point, but the feeling of disappointment will sting all the more given the advantage they earned themselves in the first half.
'We were braver in the second half' - reaction
Hearts manager Craig Levein: "I didn't think there was much in first half but Aberdeen took their chance. We've come off a poor result at Hamilton and I felt we were negative as a result of that.
"But in the second half we played higher, were braver and got more opportunities. We've got a big week ahead of us, so a lot of things to look forward to."
Aberdeen manager Derek McInnes: "We started well, and looked really confident. I was pleased right across the board with the first half. Half-time came at a good time for Hearts and a bad time for us.
"We're all scratching our heads at how we lost that game, we should have stood up to what Hearts did to us second half a lot better than we did."
- 4SouttarBooked at 84mins
- 5HaringBooked at 57mins
- 10Sutchuin-DjoumBooked at 84mins
- 19IkpeazuBooked at 62minsSubstituted forBozanicat 81'minutes
- 21BallBooked at 84mins
- 4ConsidineBooked at 74mins
- 19FergusonBooked at 84mins
- 27McLennanSubstituted forDevlinat 87'minutes
- 7StewartSubstituted forWilsonat 81'minutes
- 16CosgroveBooked at 18mins
- John Beaton
- Shots on Target
Second Half ends, Heart of Midlothian 2, Aberdeen 1.
Foul by Sean Clare (Heart of Midlothian).
Lewis Ferguson (Aberdeen) wins a free kick in the attacking half.
John Souttar (Heart of Midlothian) wins a free kick in the defensive half.
Foul by James Wilson (Aberdeen).
Christophe Berra (Heart of Midlothian) wins a free kick on the right wing.
Foul by Sam Cosgrove (Aberdeen).
Substitution, Aberdeen. Michael Devlin replaces Connor McLennan.
Jamie Brandon (Heart of Midlothian) wins a free kick in the attacking half.
Foul by Sam Cosgrove (Aberdeen).
Lewis Ferguson (Aberdeen) is shown the yellow card.
Dominic Ball (Aberdeen) is shown the yellow card.
Djoum (Heart of Midlothian) is shown the yellow card.
John Souttar (Heart of Midlothian) is shown the yellow card.
Jake Mulraney (Heart of Midlothian) wins a free kick on the left wing.
Foul by Dominic Ball (Aberdeen).
Delay over. They are ready to continue.
Substitution, Aberdeen. James Wilson replaces Greg Stewart.
Substitution, Heart of Midlothian. Oliver Bozanic replaces Uche Ikpeazu because of an injury.