Dundee United narrowly avoided a Scottish League Cup upset as substitute Nadir Ciftci struck two minutes from time to earn a thrilling 3-2 victory at Dumbarton.
Kevin Smith fired the Championship side ahead in the first half, and the home side held onto their slim lead until Ciftci levelled on 69 minutes laid on another for Ryan Gauld 13 minutes from time.
Mitch Megginson looked to have forced extra-time when he netted Dumbarton's second in the 87th minute, but Ciftci grabbed the winner moments later to send United into the third round.
The visitors should have been ahead as early as the seventh minute when David Goodwillie missed the target with a free header from six yards out.
Jamie Ewings then pulled off a smart save to keep out Brian Graham's volley, while Bryan Prunty glanced a deft header inches wide from Dumbarton's first meaningful attack.
But the home fans were celebrating on 35 minutes when former United striker Smith turned sharply in the box and beat Radoslaw Cierzniak with a precise finish.
United's response was almost immediate as Gauld rattled the crossbar with a rasping 20-yard drive, while Graham dragged wide just before the interval.
The Premiership side were again denied by the goal frame shortly after the break as Aaron Barry deflected Paul Paton's low cross onto the post with Ewing stranded.
But Ciftci netted the equaliser just seven minutes after replacing Mark Wilson, chesting down and pulling away from Scott Smith before slotting past Ewing.
Paton drilled a long-range effort over the bar before Gauld latched onto Ciftci's neat lay-off and found the net at the second attempt after Ewing parried his initial effort.
However, United then paid the price for defending too deep when Megginson collected the ball on the left edge of the box and curled a delightful effort beyond Cierzniak and into the top corner.
But Dumbarton's joy was short-lived as Chris Erskine cut inside from the right wing and pulled the ball back for Ciftci, who lashed past Ewing from 10 yards.