Hearts, like the Dons, unbeaten in four games this season, albeit in the Betfred Cup, made one change from the 1-1 draw at East Fife last Saturday, Dario Zanatta missing out, Jon Souttar replacing him. Steven Naismith was among their substitutes, three days after signing a four year deal at Tynecastle.
After a scrappy opening, the Dons' fashioned the first half chance after six minutes, Shay Logan setting Jon Gallagher on the chase down the right. His ball into the box found Sam Cosgrove but he was always stretching and couldn't get any direction on his header.
Within a minute, there were muted penalty claims as Smith ran into the back of Cosgrove, but a corner was awarded instead. Gallagher and Scott Wright worked a lovely short corner routine, Gallagher then drilling in a low cross which James Wilson drove over the bar from around the penalty spot. Perhaps he should have done better.
The goal machine that is Sam Cosgrove made no mistake in the 13th minute, slotting the Dons in front. Andy Considine cleared the ball forward, Berra misjudging its flight and only getting a glancing header on it, back towards his own goal. Cosgrove pounced on it and, cutting in from the left, expertly shaped his angled finish across goal and just inside the far post.
Prolonged Aberdeen pressure might have made it two just three minutes later, Gallagher having a shot blocked by Berra's upper arm then forcing a fine diving save from Zlamal, both ferocious shots from outside the box. The Dons were regularly looking to exploit his pace out wide on the right, using the space left by the Hearts back three.
A poor refereeing decision allowed Hearts to break in the 19th minute when Lewis Ferguson looked to be brought down on halfway, Logan tidying the move up. From the resulting corner, Irving picked out Berra who caught his header to perfection, Joe Lewis producing a fabulous diving save high to his left to push the ball over the bar.
Young Aaron Hickey hauled down Scott Wright with the ball nowhere to be seen to collect the game's first yellow card in the 27th minute, though the youthful wing-back looks better suited to getting detention as punishment.
Ikpeazu followed him into the book six minutes later - and was a little lucky to get just that - for running straight into Scott McKenna, the big centre-back poleaxed for a moment, signalling that he was less than impressed by waving away Ikpeazu's proffered handshake.
As the game started to boil over, a late challenge on Considine was missed before a lunge from Clare on Wright did earn card number three in the 35th minute.
Dikamona replaced Souttar in the 39th minute and immediately left Funso Ojo in a heap, Logan's free-kick in from the halfway line drifting out of play. Just before the break, Logan found his name in the book too, the fourth in a feisty first half. In the flurry of free-kicks that followed, Irving's dangerous ball through the box just eluded Halkett and drifted wide of goal, a let off for the Dons right at the death.
The first action of the second half saw Lewis Ferguson go in the book, catching Irving with his arm as both challenged for the ball in the 47th minute. Persistence from Gallagher down the right won a corner in the 51st minute, Wilson's delivery arcing through the box but not drawing a finishing touch from anyone.
Two minutes later, Logan was cleaned out by Mulraney who dumped him on the running track, yellow card number four coming for the visitors, Ojo swiftly testing the referee's patience again with a challenge on Walker - the seventh yellow card of the afternoon. That was symptomatic of the game, Hearts in particular looking to make the game as scrappy as possible, knocking the Dons out of their rhythm.
On the hour, Scott Wright - who had taken a knock when trying to close down Zlamal a few minutes earlier - was replaced by Ryan Hedges in the first Aberdeen change of the afternoon. Hearts responded four minutes later with the introduction of Naismith and Washington in place of Irving and Mulraney in an attempt finally take the game to the Dons. With little else happening, another substitution came in the 68th minute, Wilson making way for Niall McGinn.
As the two sides were restructuring, from nowhere Hearts were level. A long throw into the box from Smith saw Ojo win his header only for it to cannon into the back of Halkett's head, propelling the ball into the near post where Naismith was poaching to nod past Lewis. Suddenly Hearts were a yard quicker, Naismith in particular looking a threat whenever the ball came anywhere near him.
Fellow sub Washington wasn't far away in the 73rd minute either, darting away from the defence to get on the end of Clare's header forward only to put his drive into the side netting.
The goal that had been threatening came in the 76th minute, Naismith picking out Ikpeazu in acres of space. His ball into Walker's path got him away from the defence and he clipped a shot across Lewis and in off the far post as the visitors were suddenly well on top as their extra few days of rest started to tell.
It would have been easy for Dons' heads to drop but this is a group of players made of sterner stuff than that and set about turning the tide.
Crucially, Hearts were down to ten men in the 78th minute, Hickey diving in on McGinn on the edge of the box and collecting the inevitable yellow card, his second of the afternoon. The free-kick was drilled in low by Hedges and as McGinn tried to control it, Dikamona came hurtling through the back of him giving the referee the easiest decision of the afternoon - penalty. Goal number eight of the season incoming, Cosgrove thrashing the ball into the roof of the net for 2-2.
As the rest of the side celebrated, Gallagher was replaced by Bruce Anderson as Derek McInnes made his final change of the game.
The sending off and the goal had entirely changed the temperature of Pittodrie and once again, it was the Dons ascendant now, looking for that crucial late winner.
Hearts were lucky not to be down to nine men after yet another clumsy challenge from Ikpeazu, this time on Ferguson. From the free-kick, the Dons advanced down the left with Leigh. His cross drew a brilliant backheel from McGinn that dummied the Hearts defence and half the crowd too. Ryan Hedges wasn't fooled though and he swooped down upon the ball and smashed it past Zlamal for his first Aberdeen goal. He collected a booking for his understandably exuberant celebration.
From there, the Dons controlled the game and saw it through comfortably enough. Not always pretty, but Aberdeen's determination to claw the game back after shipping those two quick goals, allied to some impressive attacking play at times, bodes very well for the season ahead.
"I think it's important that you get that first win as early as possible, after the demands and the exertions of Thursday we tried to freshen things up.
"I would have liked to have done that a bit more today, with only Scott and James coming in.
"We got off to a quick start and that's what we asked for. You know when you come off the back of a European game it may have an effect in the latter stages so it was important we got off to a quick start but I am disappointed we didn't capitalise a bit more.
"I thought we were good in the first 25/30 minutes and it became a bit stop-start after that, sometimes that can be the way against Hearts and there can be no real flow to the game with a lot of free-kicks and stoppages.
"I thought we started the second half strongly with a bit more purpose about us but Hearts have go the quality on the bench, Craig makes a positive substitution with Naismith and Washington but we are disappointed with the nature of the goal.
"We know that Smith has got a long throw and I wanted my centre backs to be winning that header instead of Ojo trying to win that. It then ricochets and then Naismith gambles as he has done all his career and they equalise which gave them a huge lift.
"We were rocked and then they got the second goal, we were struggling to deal with their fresh legs at the top end of the pitch but thankfully even at 2-1 there was the resolve, the determination and the spirit of my team to find a way to get a result.
"McGinn and Hedges gave us real impetus and they had a huge part to play in both goals. My team would have been forgiven today, we always want to win but they would have been forgiven at 2-2 for settling at that after Thursday but they kept chipping away and thankfully the goal comes.
"And what a goal it was, Ryan has been threatening to do that and his finish was magnificent. It was no more than we deserved when you take everything into consideration, the injuries we have, the game on Thursday night and the fact that Hearts have had all week to prepare for the game. We have had literally 48 hours and the biggest part of that was keeping the team fresh.
"The crowd helped the team today, that was Pittodrie at its best. A real entertaining afternoon, we did it the hard way and you can see with the celebrations the way that the team are applauded off the pitch, how much that means to everyone.
"It was important to get the three points today because Hearts are a good team. When you take into account the preparation time they had, that was tough for us and it will be tough against St Mirren, against Rijeka and against Dundee. We could be doing with getting a few out of the treatment room and into the squad to help us with that.
"For now, I couldn't be more pleased, it's important to win your home games.
"Sam was up against three good centre halves and every one of them knew they were in a game today. There was grass to work in for the first goal and he took advantage of a bit of indecision but he was onto it in a flash, he was quick, purposeful and calm with his feet. He scores penalties the way that Rooney used to do, you never feel that Sam is going to miss and that's fantastic for him.
"Even if he hadn't scored I would have been delighted with his level of performance, he is a boy in a good place at the moment and he clearly loves playing here. Particularly at Pittodrie scoring goals.
"He wouldn't have played today if Curtis was fit because I wanted to freshen the whole front line up and I wanted to play Bryson but a little groin strain has curtailed that.
"It's good that we have good options to come back, we are hoping that Devlin can maybe travel to Croatia but for now we will just enjoy today and get the boys rested down now over the next 48 hours.
"Funso has a bit of ice on his knee but I think he will be ok. For the players who have played both games it has been a big effort. Greg Leigh has hardly had a pre-season but for the winning goal he could have played a simple pass but he takes Walker on at the by-line and gets his cross in and then McGinn and Hedges quality shows.
"It's a good win for us because Hearts are a good side and they have made some good signings, everyone will go home happy today."