The visitors, who had Frazer Wright sent off in the second half, came from behind three times but were eventually undone by Steven Thompson’s 87th minute winner – giving St Mirren their first home win of the season.
The home side took the lead after just seven minutes, a fine passing move through midfield rounded off by Kenny McLean whose neat finish beat Allan Mannus.
St Johnstone equalised after 15 minutes, Nigel Hasselbaink exchanging passes with Stevie May before picking out Steven MacLean at the far post for a simple finish.
St Mirren re-took the lead after 58 minutes to spark the game back into life when a long pass from Lee Mair found Paul McGowan who beat Mannus from just inside the area.
But no sooner were the home side in front however than the visitors hit back, Hasselbaink finishing well from 10 yards (60).
Mannus then kept St Johnstone level with a fine penalty save from Jim Goodwin after McLean had been fouled in the area – the keeper guessing correctly to save the spot-kick low to his left.
St Johnstone were reduced to 10-men when Wright hauled back McGowan – and this time McLean assumed penalty taking duties and made no mistake from the spot (75).
Rory Fallon, on as a substitute for Gary McDonald, then drew St Johnstone level for a third time, sliding in to poke home May’s cross (83).
But it was St Mirren – and Thompson – who had the final word with a winner from close range in the final minutes.