The Aberdeen starting eleven showed three changes from the line-up who kicked off against Cove Rangers last week.
Ash Taylor made his first appearance since July when he played in Tbilisi against Chikhura Sachkere, taking the place of Luc Bollan, while Tyler Mykyta replaced Dean Campbell who is on Scotland Under 21 duty. Calvin Ramsay slotted in at right back to allow Lloyd Robertson to move into the midfield in place of Stephen Gleeson.
Inverurie Locos, currently sitting second behind Brora Rangers on goal difference in the Highland League, were on usual lines.
Both sides took time to settle into the game although the Dons had the bulk of possession. In ten minutes, a long ball from Luke Turner nearly fell for Seb Ross but keeper Reid was quickly off his line to smother the danger.
Seconds later a Calvin Ramsay cross into the box caused some panic in the Locos defence but the ball was deflected away for a fruitless corner. Sam Jackson was called into action for the first time on 14 minutes diving to his right to parry Gauld's header from Hunter's cross.
The heavy rain wasn't dampening the enthusiasm of the Locos drum corps who were making plenty of noise and they were close to celebrating when a clever Souter free kick almost created an opening, but Ash Taylor used all his experience to clear.
They were cheering in the 21st minute though as Calum Dingwall thundered a thirty yard effort past Jackson following a corner. It was a real bolt from the blue after the Dons having most of the ball for the opening period.
Aberdeen's passing wasn't as crisp as it has been in recent weeks and they were finding it difficult to find space against a well-disciplined Inverurie defence.
A quick break from Locos saw Gauld force a save from Jackson, the striker always looking a danger when he had the ball.
There was plenty of perspiration but a lack of inspiration from the Dons who fell two behind on 41 minutes when Ryan Stott raced on to a Gauld flick to fire the ball past a stranded Jackson.
A minute before the break a heavy tackle on Ethan Ross saw Hunter red-carded, Ash Taylor being cautioned for his reaction to the tackle.
A lacklustre opening half from Aberdeen who have it all to do in the second period if they are to progress in the competition, but Locos will play with only ten men after Hunter's dismissal.
David Dangana replaced Tyler Mykyta at the break. Bruce Anderson had the first effort on goal, but Reid saved his header from Booth's cross comfortably.
Michael Ruth had the ball in the net on 52 minutes as he flicked in Ethan Ross's through ball, but the flag was up for offside. The pressure was starting to build from Aberdeen, Ethan Ross seeing a shot blocked.
A wonderful turn on the edge of the six-yard box saw Gauld find space for a shot, but he dragged his effort into the side-net. A reminder that, despite being a man short, Locos were still a danger.
Ramsay tried his luck from the edge of the box, but Reid was again well positioned to save. With twenty five minutes left Aberdeen were desperate to get themselves back into this match.
A second Dons change saw Kevin Hanratty replace Booth on 67 minutes. The change paid immediate dividends when Hanratty's burst into the area saw the ball laid back to Anderson who rifled the ball into the net.
A long clearance from Taylor sent Dangana racing clear but his shot was blocked before he got another effort away which was deflected wide. For the first time in the game the Locos defence was creaking.
Reid saved well from Ruth but was helpless on 75 minutes when Dangana converted Hanratty's cross. The benefits of full time training were beginning to have an effect along with Locos' numerical disadvantage.
Michie's long range effort flew just over as Locos tried to snatch a winner, the game becoming very stretched as the lottery of a penalty shoot-out loomed.
Connor Barron came on in the 90th minute to replace Ramsay perhaps with the impending shoot-out in mind. Despite plenty of effort from both sides, it ended all square at two apiece.
In the shoot-out, Locos scored all five from the spot while Kevin Hanratty fired Aberdeen's second spot-kick over the bar to earn the Harlaw Park outfit a semi-final game against either Huntly or Turriff United.