Kenny McLean gave the Buddies the lead but Gary Irvine's fouth goal of the season and Iain Davidson's first gave Paul Hartley's men the points.