Both sides received a standing ovation after a seven-goal thriller but it was Livingston who emerged with the points despite the Sons’ late push that gave the visitors a real fright.
Dumbarton - Gilhaney 71; Lithgow 90; Prunty 90+4
Livingston - Russell 45, 84; Scougall 48; Morton 86
There was little hint of the drama to follow as the visitors led by a single Iain Russell strike at the interval.
However, after Stefan Scougall extended Livingston’s lead and Mark Gilhaney pulled one back, four goals were crammed into the last six minutes.
Livingston boss Gareth Evans said: “We knew it would be difficult coming down here because Dumbarton have been on an incredible run since Iain Murray took over [as manager]. To get a win, albeit with a disappointing performance, is great.
“We had a few tired legs at the end but we managed to sneak it.”
Dumbarton started brightly and came closest to an opener when Bryan Prunty’s deft chip bounced on top of the bar before going over.
A slick exchange brought the opener on the stroke of half-time, Burton O’Brien and Marc McNulty creating the opening for Russell to finish emphatically from 16 yards.
Livingston doubled their advantage on the restart when O’Brien released Anthony Andreu, whose cut-back gave Scougall a simple tap-in.
Dumbarton threw themselves a lifeline when Gilhaney found space on the edge of the Livingston box and drilled an unstoppable shot into the bottom left-hand corner of the net.
They pushed for an equaliser but the visitors sealed it when Russell, pictured left, netted his second with a glancing header from Callum Booth’s cross and then Jordan Morton gave them breathing space with a spectacular 25-yard effort.
But the Sons refused to throw in the towel and scored a further two goals in injury time through Alan Lithgow’s header and a drilled Prunty shot.
Murray declared: “If we’d lost 4-1 it would have been an absolute travesty.
“I thought we were excellent and although the two goals at the end didn’t change the result, they change the mindset. They could be crucial if it goes to goal difference.”