Last updated on .From the section Scottish Cup

A late Sam Cosgrove penalty spared Aberdeen's blushes as League One Dumbarton were denied a Scottish Cup fourth-round replay.

The visitors had defended stoutly and were less than five minutes away from a cup shock at Pittodrie.

But after Rico Quitongo was adjudged to have tripped Cosgrove inside the box, the striker stepped up to score his 21st goal of the season.

It was enough to send the Scottish Premiership side into Sunday's draw.

But it was harsh on Jim Duffy's Dumbarton, with goalkeeper Conor Brennan having relatively little to do as Aberdeen passed up a glut of chances.

Derek McInnes may only have made one signing so far in January, but there was a freshness about Aberdeen's line-up, with Funso Ojo partnering debutant Dylan McGeouch in midfield.

Dumbarton battled gamely to keep the home side out. Connor McLennan, Ash Taylor, Cosgrove and McGeouch all could have opened the scoring, though Brennan was relatively untroubled by all the efforts.

And he only had to watch as Bruce Anderson blazed a chance over the bar, and Andrew Considine failed to hit the target from a cross.

Aberdeen had been held at home at this stage by Stenhousemuir 12 months ago, and another replay looked likely as Niall McGinn thumped a low cross wide and Scott McKenna headed over from a yard out.

And Dumbarton began to sense there was an opportunity to win the tie in the 90 minutes. Twice Stefan McCluskey got a run on the defence down the left, but on both occasions his delivery let him down.

The pressure from Aberdeen intensified. Anderson spurned further chances but, just as it looked like a replay was inevitable, Cosgrove's legs were taken from under him and the deadlock was broken.

Dumbarton pressed for a dramatic late leveller, and McKenna had to divert a dangerous ball into the box for a corner, but Duffy's side couldn't make the corner kick count as time ran out on them.

Aberdeen manager Derek McInnes: "We had - I think - 28 shots so we are bemoaning the fact that we have got to be far more clinical and sharper in that final bit.

"That for me was a 3-0 or 4-0 game, but it wasn't and that was down to the perseverance of the Dumbarton lads and their organisation and us not taking our chances."

Dumbarton manager Jim Duffy: "We tried to make it an awkward day for Aberdeen and we certainly did that. They had to shuffle the pack several times to try and get the result.

"But overall I was absolutely delighted with the performance we put in, we were organised and we gave everything and really that is as much as you could ask from our team."