Playmaker Connor Ronan sealed his timely return from suspension with a dramatic late winner to give St Mirren's top six hopes a serious boost.
The Buddies knew they had the perfect chance to fire themselves firmly into the mix for a top half finish against Premiership strugglers Dundee.
They spurned the best opportunity in the first half when Wigan loanee Jordan Jones failed to make the most of an excellent chance with Dee keeper Harrison Sharp off his line.