Craig Dargo's late header earned Dumbarton a 2-1 victory and relegated Stirling from the Scottish Second Division.
Patrick Walker could have given the visitors an early lead but he failed to control his shot after breaking into the area.
The hosts' first opportunity fell to Graham Weir but he failed to find a way past Stephen Grindlay with a tame effort.
Grindlay's opposite number was given a more stern test as Callum Reidford spread himself well to block at the feet of Walker.
Alan Lithgow was next to go close but Reidford did well to tip his effort over the bar.
They broke the deadlock just before the hour mark, Scott Davidson finishing from close range after good work by Darren Smith.
But they were pegged back 12 minutes from time when Devon Jacobs turned Scott Agnew's corner past his own keeper.
However, substitute Dargo headed home Agnew's cross in stoppage time to snatch three points.