Aberdeen midfielder Lewis Ferguson scored an injury-time winner to settle a topsy-turvy game at Pittodrie and gave the home side a deserved 3-2 win against Livingston.
Niall McGinn had the home side ahead after just nine minutes but goals from Scott Pittman and Jack McMillan turned the game on its head.
Sam Cosgrove bundled in a leveller after 57 minutes before Ferguson’s late intervention.
The home side had started positively, looking for a reaction to their weekend defeat at the hands of St Johnstone, and after just three minutes, Stevie May warmed the palms of Liam Kelly after Graeme Shinnie’s through ball.
And they were in front after nine minutes, Shay Logan’s throw-in on the right setting Cosgrove free and his pacy drive across the area was neatly side-footed home by McGinn.
But Livingston were quickly level. Joe Lewis raced to the edge of his area to deny Craig Sibbald, but could not hold onto the call and Pittman, via a despairing touch from the goalkeeper, tied things up just three minutes later.
Aberdeen looked the more likely to restore their lead with first May and then Scott Wright going close.
But it was the visitors who went in front after 33 minutes. Dolly Menga gave the ball away but showed the industry to win it back before playing in Pittman, who in turn fed McMillan to angle a low shot into the far corner.
The Dons thought they were in line for a penalty when Craig Halkett blocked off May after some neat footwork right on the corner of penalty area and bye-line, but the foul was adjudged to be outside area, and Halkett – already booked for a foul on Logan – escaped without further punishment.
Aberdeen introduced Connor McLennan at the interval, and the youngster made an instant impact as he fired in a cross from the right from which McGinn came close to equalising.
And it was a similar cross, again from McLennan, that led to Cosgrove turning home the leveller from close range just before the hour mark.
Aberdeen were now in the ascendency and should have been ahead when Andrew Considine, up from centre-back, somehow contrived to head a May cross wide of the target.
May was involved again a minute later as he fed Cosgrove, the striker going down under the challenge of Scott Robinson but ending up seeing a yellow card as referee Craig Thomson adjudged him to have dived.
Despite heavy pressure, time looked to be running out for Aberdeen, but Ferguson hooked in a McGinn corner two minutes into injury time to win the points.