Lewis Ferguson came back to haunt his old side as he netted the winner for Aberdeen at Hamilton Accies.
Returning from a two-game ban, Ferguson netted before the quarter-hour mark to give the Dons a much-needed three points.
On the back of heavy defeats to both Old Firm sides, anything other than three points at New Douglas Park would have been unacceptable.
The victory keeps them fourth, a point behind Motherwell a place above.
Aberdeen made three changes from the 4-0 defeat against Celtic, with Ryan Hedges, Craig Bryson and Ferguson coming in for Michael Devlin, Jon Gallagher and Connor McLennan.
Neither side wasted any time in getting out of the traps. Mickel Miller had two chances inside the first 10 minutes, heading one wide and forcing Joe Lewis into a one-handed stop, while Sam Cosgrove scuffed the chance to open the scoring for the visitors.
Where Cosgrove failed, Ferguson succeeded on 14 minutes. Hedges slipped a free-kick in behind the wall to Ferguson, who took a touch before crashing past Owain Fon Williams.
Hedges and Cosgrove both had attempts deflected wide of Fon Williams’ goal while Lewis Smith let fly from long range, requiring Joe Lewis to tip over.
Cosgrove, looking for his 16th of the season, jabbed out a leg at Ferguson’s in-swinging cross but did not make a clean connection, allowing Fon Williams to gather at the second attempt.
The Accies faithful were growing frustrated with the fare on offer from there side but Ross Cunningham nearly gave them something to cheer before the interval. A quick one-two with George Oakley freed up the midfielder to shoot but the ball flashed past Lewis’ near post.
The half finished with the Dons on top though as McGinn, cutting inside from the left, crashing an effort off the crossbar.
Bryson came off at half-time for Dean Campbell, cutting short his return to the starting 11 at 45 minutes.
Fon Williams was called into action immediately to deal with Ferguson’s shot and McGinn latched on to the rebound, only to send it across the face of goal.
In a game that was becoming increasingly frantic, both sides had penalty appeals turned down. Accies players felt Scott McKenna had felled Oakley but Willie Collum was unmoved, before the official also ignored Aberdeen’s pleas for a handball against Sam Stubbs.
The Dons had raised their game after the break with Ferguson coming close on two occasions, landing one cross on to the bar and seeing an acrobatic attempt cleared off the line by Jamie Hamilton.