Following Saturday's 5-0 thumping of Livingston, Jim Goodwin made three changes to the side for the trip to Galabank. Jack MacKenzie made his first start of the season, Shayden Morris his first for the club, and Matty Kennedy was back in the side too. Hayden Coulson missed out with injury and Jonny Hayes and Leighton Clarkson both started from the bench.
There were two changes for the hosts after their 2-2 draw at Albion Rovers at the weekend. Benjamin Luissint and Tommy Muir replaced Tommy Goss, who started on the bench, and Dominic Docherty.
It was a first test on the AstroTurf this term for the Dons and from the outset, Annan understandably looked to defend in depth with ten men behind the ball, with space in the final third at a premium.
The visitors kept the home side penned in in the early stages but despite a couple of goalmouth scrambles, it was 17 minutes before there was a threat on goal. Kennedy danced into the box and fired off a low shot. It took a deflection and Swinglehurst had to hack it to safety off the line with Fleming wrongfooted.
Morris was next to accelerate into the area but as he looked to shoot, he lost his footing and ended up skying the ball into the crowd on 19 minutes. A tempting Kennedy cross seven minutes later had no takers as Aberdeen tried to apply further pressure in what was a very frustrating first half an hour to the game.
Morris was on the run on the counter-attack of 34 minutes before a Swinglehurst body check stopped him in his tracks - no booking, not even a foul, much to Morris' amazement.
An Annan corner almost gave them the lead on 39 minutes, Johnston's ball into the box reaching Muir who manufactured a clever flick goalwards that cannoned away to safety off the far post.
A late corner for the Dons gave some hope of a break in the stalemate. Kennedy's ball into the near post was met by Liam Scales who glanced a header on across goal. Anthony Stewart was coming in but couldn't get the decisive touch that was needed.
Jonny Hayes and Duk came on in place of Kennedy and Morris at the break as Aberdeen looked to up the tempo.
The Dons should have had a penalty on 49 minutes. Hayes clipped a cross in from the left and Hunter clearly handled it, though to be fair, he did only use the one hand. It was a stonewall penalty, but nothing was given.
Aberdeen were slicker now though and Jayden Richardson was down to the by-line on 52. His cross to the back post reached Duk who got up high but his flicked header crept inches wide of the frame.
Annan responded though, the ball dropping nicely for Luissant two minutes later, his volley straight at Kelle Roos who made a comfortable save.
Aberdeen were in the lead at last on 55 minutes. Hayes was the instigator down the left, scooping a low cross through the six yard box, Vicente Besuijen bustling in at the back stick to bundle the ball over the line. Hayes' introduction had electrified the Dons and the game.
Scales saw an opportunity on the hour, firing a lovely ball over 50 yards towards Bojan Miovski, the number nine taking it on the volley but shooting wide from a tight angle. Much more enterprising from the Dons who were a different side after the break. Miovski picked up an unnecessary yellow card on 66 minutes for not retreating at a free-kick.
Richardson wasn't far away from a first Aberdeen goal a minute later, coming onto a pass from Besuijen, his shot from just inside the box skimming over the bar.
A Johnston corner caused problems again on 75 minutes, Kilsby winning the first header, Muir the second, but fortunately, his effort from six yards was straight down Roos' throat.
Jim Goodwin made a double change three minutes later, Miovski and MacKenzie replaced by Ryan Duncan and Clarkson. The game wasn't done yet though, Annan winning another corner on 80 minutes. It proved decisive, Johnston's cross sailing to the back post. Swinglehurst was the most determined to win it and he powered a header back across goal and into the net.
Annan took confidence from that and began to threaten the Aberdeen goal but that at least opened the space up a little as the game suddenly went from end to end. The Dons won an 88th minute corner on the right, but Hayes' delivery was pouched by Fleming under no real challenge.
A searing run from Richardson opened things up on 89. The ball was worked into Besuijen 20 yards out, but his shot was over the bar and into the Dons fans behind the goal. Ylber Ramadani tried his luck from distance a couple of minutes later, but it flashed across goal and wide of the target. Ross McCrorie had the last shot of regulation time, a 25 yarder just wide of the target.
Four minutes into extra-time, after the Dons had pinned Annan back, McCrorie had a chance from six yards out, stretching to poke the ball over the bar as Aberdeen opened strongly.
A couple of corners in quick succession gave further hope to the visitors and the second made the difference. From the left, Clarkson drifted the ball into the near post, Duk losing his marker to get a great connection on his header to flash it past Fleming and regain the lead.
Annan made their first change on 99 minutes Lowdon replaced by Steele.
Duk was in the mood now, collecting a loose clearance on the edge of the box. Quick feet got him a little space and his shot threatened the goal but dipped just a fraction too late.
On 103, Annan might have been level. Ramadani and Stewart got in each other's way, leaving Muir in on goal. He pulled the ball back for Luissint 10 yards out but fortunately, under pressure from Hayes, he scuffed his shot and it was an easy low save for Roos.
Besuijen was on the mark again on 105 to extend the lead and finally give Aberdeen a bit of a cushion. Hayes played the ball into him in the left half of the box and he looked up and threaded the ball across goal, past the unsighted Fleming and into the far corner for 3-1.
Clarkson was on the run on 107 minutes, deep into Annan territory before looping a pass to Duncan. In trying to take the ball round the 'keeper, Duncan lost control of it and it bobbled behind. Williamson made way for McCartney on 111 minutes as the Dons fans started to think about taking the long and winding road home.
Duncan should have made it 4-1 on 114 minutes, coming inside from the right before putting a low shot across goal but wide of the far post with Besuijen looking for a cut-back in the six-yard box.
Clarkson did make it four three minutes later. He collected a long ball from Duncan into the box, beat Steele to the ball then cane a couple of steps inside and dragged a low shot into the bottom corner from 15 yards out which, for Clarkson, counts as a tap-in.
It was a long and at times difficult night but, in the end, it was job done for the Dons.