Aberdeen left it late to claim a 1-0 victory over Dumbarton in the William Hill Scottish Cup, but Sam Cosgrove's penalty eventually saw them progress in a match they should have had wrapped up long before.
The Dons, who handed a debut to new recruit Dylan McGeough, were dominant from the off against their lower league opponents but the majority of their chances in the first half came from Niall McGinn set pieces, with the Northern Irishman delivering the free-kick that saw Cosgrove head wide.
Corners from the same man saw Ash Taylor and Andrew Considine head off target as the Dons shot toward the new singing section being trialled at Pittodrie, while Bruce Anderson fired wide after a Cosgrove effort had been blocked.
Just after the half hour, McGinn himself had an effort after good build-up on the left involving Considine and Funso Ojo, but his shot sailed high and wide of the target.
There was a sense a goal was coming but half-time arrived with the scoresheet blank, although Anderson saw another shot blocked in the 45th minute.
The second half continued in the same vein, with the Sons' goal peppered with shots although Conor Brennan was rarely troubled.
McGinn continued to be the key man, but he shot wide in the first minute of the second half before seeing his corner headed onto the post by Considine just before the hour.
Anderson was making a nuisance of himself and should have scored from a McGinn cross five minutes later, but shot over at the back post.
McGinn came close yet again as he curled an effort wide of the far post with 10 minutes remaining, but there was a sense their domination could fail to be rewarded.
That changed in the 86th minute when Cosgrove pounced on a loose ball in the area and tempted Morgyn Neill into a rash challenge which saw the Dons awarded the spot-kick, from which the striker netted to the keeper's left.