St Johnstone extended their unbeaten away run to five games with victory over 10-man Kilmarnock.
But the match will be remembered for the controversial sending off of Kilmarnock captain Manuel Pascali.
Murray Davidson opened the scoring for the visitors, but Michael Nelson thought he had rescued a point with his second half header.
Rowan Vine's toe-poked finish with two minutes remaining saw the Perth side claim all three points.
Pascali was shown a straight red card by referee Stevie O'Reilly after six minutes for a robust challenge on Nigel Hasselbaink.
It looked as though Pascali took the ball cleanly, but the referee disagreed and brandished the red card.
Kenny Shiels was furious and a few minutes later was sent to the stand.
With their numerical advantage, St Johnstone enjoyed most of the early possession as Kilmarnock had to reshuffle their pack.
The visitors could have taken the lead with chances for Gregory Tade and Liam Craig - Cammy Bell standing firm in the Killie goal on both occasions.
But the pressure finally told after half an hour; Tade scuffed a shot on the edge of the box and Davidson swept home from 10 yards.
St Johnstone might have doubled their lead had they been awarded a penalty just five minutes later, but the referee instead booked Vine for diving when it looked as though he was illegally felled in the box.
Perhaps feeling an element of injustice during the half-time interval, Kilmarnock came out for the second period looking vibrant and striker Paul Heffernan came close for the hosts.
He ghosted past two St Johnstone defenders before unleashing a vicious shot from 20 yards that was palmed away by Alan Mannus.
Cillian Sheridan also came close to equalising, but his snap shot volley from a tight angle arched high and wide.
With an increasing freedom about their play, Kilmarnock left space for their opponents to exploit, and both Liam Craig and Chris Millar had chances to cement the three points.
From his adopted position in the stand which was in fact just behind the dugout, Kenny Shiels urged his side forward as the game entered its final stages.
And their endeavour was rewarded with 10 minutes remaining when Nelson rose to nod beyond Mannus.
At that stage it looked as though there would only be one winner as Killie pressed for an unlikely three points.
But given the cruel fate that football often conjures up, St Johnstone, against the run of play, stole a victory with two minutes remaining.
Millar played through Vine, and as Bell rushed from his goal, the substitute poked past the Kilmarnock goalkeeper.