A crowd of 8,089 turned out on an afternoon of glorious spring sunshine and saw Ray McKinnon's team edge out Jack Ross' side.
Tony Andreu's spectacular strike gave United the lead but Rory Loy quickly equalised for the Buddies, who created several first-half chances.
Substitute Thomas Mikkelsen grabbed the winner with 15 minutes left when he headed a Simon Murray cross past keeper Billy O'Brien.