Jim Goodwin made one change from the side beaten at Celtic Park last weekend, Liam Scales coming back into the side after being ineligible against his parent club. With Ross McCrorie moving back into midfield, Dante Polvara started from the bench. New loan signing Leighton Clarkson was on the bench too, with Connor McLennan and Liam Harvey dropping out of the matchday squad.
After the 1-0 home defeat to Motherwell last Sunday, Stephen Robinson made three changes to his starting XI. In came former Don Curtis Main, Richard Tait and Greg Kiltie in place of Mark O'Hara, Scott Tanser, both out injured, and Alex Greive, the latter starting on the bench.
It was a scrappy opening, both sides wasteful in possession in the early minutes. Ylber Ramadani was the first to get the pulses racing, coming inside from the right and pummelling a left foot shot at goal that went just over the bar on eight minutes.
Gallagher went in the book a minute later after scything down Hayden Coulson as he accelerated away from him, the left-back requiring lengthy treatment in the aftermath. Eventually Coulson hobbled down the tunnel, Clarkson getting an early debut for the Dons. Scales went out to left-back, McCrorie back into defence. He had an early sight of goal too, picking up on a loose ball 25 yards out and firing a drive at goal that swerved wide of the target on the quarter hour.
Matty Kennedy stepped up to take a free-kick on 18 minutes. The ball was central, 30 yards out and though Kennedy beat the wall, he put it straight into Carson's gloves. St Mirren were on the break from there, Main driving the ball across goal. Kelle Roos could only push the ball back into the centre of the box at full stretch, Ramadani swooping down to take the ball off Ayunga's toe as he looked set to score.
On 22 minutes, the Dons were in on goal after some good passing. It culminated in Vicente Besuijen thrashing in a shot from the edge of the box that thumped off the post and bounced back to Scales. His shot was goalbound until Gallagher hurled himself at the ball, blocking it with his hand. Penalty and a second yellow for the returning Gallagher, who made the short trek down the tunnel to the dressing room. Bojan Miovski was on penalty duty once again and he smashed a low left footer into the bottom corner for the lead.
A clever corner routine came on 29 minutes, Jonny Hayes playing into Besuijen, coming short. He laid it off first time, back to Kennedy 20 yards out, Scales' glancing header from the cross drifting wide.
He wasn't far away with another glancing header on 33, up well at the near post to meet Kennedy's corner, the ball flashing across goal and just wide.
Miovski underlined his goal poaching instincts on 37 minutes, stabbing in a brilliant centre-forward's goal. Hayes came in off the right and sent in a low cross to the near post. Which took a s light deflection off Tait. While Carson stood and waited for the ball to come into his hands, Miovski appeared from nowhere, got in front of him and diverted the ball just inside the post for 2-0.
More threat from the Dons after 44 minutes, Jayden Richardson hoisting the ball up to the back post, Kennedy missing his kick with an effort at an acrobatic volley.
Moments later, Miovski looked to be in behind from a Hayes pass and in for his hat-trick, but Carson was out quickly to smother. The ball ran loose to Kennedy who waited his moment to roll the ball into the path of Clarkson, running towards goal, and from 25 yards, he crashed the ball into the roof of the net for 3-0.
St Mirren replaced Main at the break, Flynn on instead as the Buddies reorganised their ten men.
Ayunga was booked inside a couple of minutes of the half for a hack on Kennedy on the halfway line. There was chaos in the St Mirren box moments later, Miovski and Besuijen both close to popping in a fourth goal before the visitors scrambled the ball away.
St Mirren finally found a foothold in the game with a penalty when Hayes was adjudged to have bundled Kiltie over in the box as the pair chased it down, a very soft looking award. Ayunga put the ball low down to Roos' left. He got a hand to it, but the ball rebounded up into the roof of the net for 3-1.
Aberdeen reasserted control immediately though, good spells of possession football keeping St Mirren penned deep in their own half of the field. It should have brought a goal on the hour, Miovski threaded in behind by Scales. The ball seemed to take an age to reach him, giving Carson chance to block, then when Hayes had recycled the ball to Besuijen, his fierce drive was saved.
McCrorie went in the book on 62 minutes, presumably for dissent after being penalised for an innocuous looking challenge. A minute later, Kennedy was replaced by Callum Roberts. Duk and Christian Ramirez were added to the fray on 72 minutes, Hayes and Miovski making way.
A deep Richardson cross caused consternation three minutes later, Besuijen bending to head at goal, the ball blocked behind for a corner. Flynn cleared that after good work from Richardson to get the ball back into the box after the initial clearance.
Ayunga and Baccus were switched for Brophy and Greive by the visitors with a dozen minutes left on the clock. Roberts went down off the ball and needed treatment a couple of minutes later, eventually limping off, leaving the Dons down to ten men for the latter stages of the game.
That gave fresh heart to the Buddies, winning an 84th minute corner that McCrorie had to deal with at the back post. They kept the Dons penned in and from a throw, worked the ball back into a shooting opportunity for Brophy who hooked the ball over the bar. Kiltie was booked for a push on Richardson on 85.
The Dons sealed the game on 87 minutes, thanks initially to some brilliant work by Ramirez on halfway. Good first time control to get hold of an awkward ball into him on halfway enabled him to measure a perfectly timed ball forward that split the St Mirren defence and set Duk on his way. Advancing into the box, he drew the goalkeeper before dinking the ball over him and in off the far post, his first goal for the club.
Scales wasn't far away as we entered the last minute, Besuijen clipping the ball into the edge of the six yard box, Scales up to win the header, Carson saving comfortably enough. Strain was then replaced by Taylor as the clock ticked down on a first league win of the season for Aberdeen.