In a game of three high-quality goals, Aaron Doran opened the scoring for the visitors in 65 minutes but Stuart Bannigan quickly levelled for the home side.
Tom Walsh lashed home the winner nine minutes from time as John Robertson's men moved up to fourth while Thistle remain in the relegation zone.