St Johnstone had every right to feel furious at this Pittodrie defeat after a controversial penalty given against them turned a game they had been in control of.
Liam Gordon scored his first goal for the McDiarmid Park club to put Callum Davidson’s men in front.
But on the stroke of half-time referee Alan Muir spotted an infringement when Sam Cosgrove threw himself to the ground after Shaun Rooney barely touched him and the Dons striker scored the subsequent penalty.
It was undoubtedly the defining moment of the contest and Ash Taylor scored Aberdeen’s winner nine minutes into the second half.
There was an early blow for Saints when Scott Tanser had to come off with a knee injury that could well be a serious one. He was replaced on four minutes by Callum Booth.
The Perth side settled into the match nicely after that, though, with David Wotherspoon and Ali McCann both coming close from 18 yards out.
Saints got a deserved breakthrough on 39 minutes when Gordon headed home a Liam Craig free-kick at the back post.
In the first minute of stoppage time their hard work was undone by a shocking decision from the referee to award Cosgrove a penalty for a push that didn’t happen.
The striker took the spot-kick himself and sent Zander Clark the wrong way.
Less than 10 minutes into the second half Saints were a goal down when a Lewis Ferguson corner wasn’t fully cleared and Taylor fired home.
It took a while for Saints to rediscover their first half rhythm but they did finish strongly.
There was a penalty shout when Taylor climbed all over Shaun Rooney but, to the surprise of nobody in blue and white, it wasn’t given and Stevie May and Callum Hendry both came close.
And to top it all off, like Michael O’Halloran in midweek, substitute Hendry was sent off for two yellow cards.