Liam Craig's late header ensured St Johnstone will finish in the Scottish Premier League's top six as Dundee United were denied victory in Perth.
Teenager Ryan Gauld's first senior goal, a low shot from the edge of the penalty area, edged United in front.
But the visitors were reduced to 10 men in the second half when Stuart Armstrong received a second booking.
Saints pressed for a leveller and were rewarded when Craig netted in the third minute of injury time.
The result also guarantees Ross County a top-half place when the division splits in two later this month.
United, who were without winger Gary Mackay-Steven after he picked up an injury on international duty with Scotland, enjoyed the bulk of possession early on without seriously threatening.
And it was Saints who created the first meaningful chance when Craig's corner was headed narrowly over by Murray Davidson.
But Craig was caught in possession by Mark Millar moments later and 17-year-old Gauld got a vital touch on the eventual through ball to nudge it past Alan Mannus into the net.
Steven MacLean's near-post flick from a corner did not have the beating of Radoslaw Cierzniak and Craig's free-kick drifted over as the hosts pressed before the break.
St Johnstone were restricted to long-range efforts for a period in the second half but one such strike by Craig required a superb save from Cierzniak.
The pressure on the United goal was growing and Barry Douglas nodded a Davidson header off the line before MacLean's looping headed effort was tipped onto the post by the Polish keeper.
Armstrong, who had earlier been cautioned for a foul on Gregory Tade, was dismissed when referee Iain Brines judged the midfielder to have dived in the box and produced a yellow and then a red card.
Cierzniak made another telling save from Davidson's low shot and any hope of a Saints comeback looked forlorn when MacLean blazed over from a promising position.
But substitute Mehdi Abeid picked out Craig from a corner and this time the effort beat Cierzniak.
United now require other results to go their way if they are to claim a top-six place. Jackie McNamara's men are level on points with seventh-place Aberdeen ahead of the meeting of those two sides on Saturday.
However Kilmarnock, who also sit on 41 points, have a game in hand against St Mirren on Wednesday before the final round of pre-split fixtures.