Calum Gallagher missed an early opening but made up for it after six minutes when he worked his way down and picked out Thomson who flicked the ball home.
A stunning double stop from Alan Martin kept Dumbarton ahead, with the shot-stopper keeping out a Jean-Yves M’Voto header and then Kyle Benedictus’s follow-up.
Christian Nade shot against Pavol Penska’s legs and Thomson was denied from long range before the hosts grabbed their second two minutes from the break when Thomson volleyed in an Andrew Stirling corner at the far post.
Thomson turned creator 90 seconds into the second half as he picked out Sam Stanton to bundle the ball home from close range.
Bobby Barr and Declan McManus both had chances to reduce the deficit but their efforts were blocked. Deep into injury time substitute Garry Fleming danced round two defenders before rolling in the fourth.