Livingston needed extra time to see off Dumbarton 3-2 and reach the third round of the Scottish Communities League Cup.
Dumbarton took the lead after 36 minutes when Steven McGougall played in James Lister, who smashed the ball into the top corner from 12 yards.
The lead lasted just two minutes, though, with Nicky Devlin fouling Iain Russell in the area and the striker picking himself up to slot home the penalty.
In extra time Robert Barr tucked in Marc McNulty's pass to put Livi ahead and the lead was doubled when Dylan Easton thumped in number three.
Dumbarton refused to lie down, though, and Bryan Prunty teed up Mark Gilhaney to pull one back and set up a tense climax.