Steven Saunders headed the Jags in front midway through the first half but Lawrence Shankland equalised early in the second period.
Peter Pawlett forced the ball over the line in the 73rd minute as Robbie Neilson's men made it two wins out of two in the Ladbrokes Championship.