Mark Reynolds scored the winning spot-kick for Aberdeen after Championship side Alloa took them to a League Cup penalty shoot-out.
Alloa hung on in normal time and extra-time despite the Dons domination.
Peter Pawlett had some of the hosts best chances in open play but Daryll Meggatt's header was not far away for the visitors.
Michael Doyle missed for Alloa in the shoot-out, allowing Reynolds to fire Aberdeen into the third round.
Cup success is one of manager Derek McInnes's main remits at Pittodrie and his charges cut it slightly fine here.
As you would have expected, Aberdeen took the game to their visitors and Niall McGinn's free-kick was collected fairly comfortably by Alloa goalkeeper Scott Bain.
The Dons threatened again from a corner but defender Mark Reynolds directed his header over the crossbar.
Bain's next test was to tip over a good volley from Aberdeen midfielder Pawlett.
Alloa manager Paul Hartley, a former Aberdeen player, almost watched his side take the lead against the run of play when Meggatt's header was diverted away from the top corner by the hand of goalkeeper Jamie Langfield.
The industrious Pawlett saw another one of his drives whistle over the bar as the Dons re-established their domination.
Alloa's Ryan McCord whipped over a free-kick for Stephen Simmons to knock just over to give the hosts an early second-half scare.
But more worrying for Derek McInnes's side were the injuries to two key players.
Firstly, Willo Flood pulled his hamstring while chasing the ball and then Jonny Hayes was stretchered off in a concerning state following a head-knock.
A fraught ending to the 90 minutes did not bring any goals.
Aberdeen looked rejuvenated in extra time and Meggatt had to be on his toes to intercept before Calvin Zola pulled the trigger.
Zola remained in the thick of the action, directing a header well-wide. Scott Vernon, too, missed when Bain let a long ball go through his hands.
So then, to penalties, and after both sides scored all five of their initial kicks, Doyle missed for Alloa and Reynolds scored to bring relief to Pittodrie.
Sorry, we were unable to load match stats, please try again.