Mark Yardley appeared to have struck twice to give St Mirren a relegation lifeline at St Johnstone until television evidence proved that Darren Dods had got the last touch on the opener.
But Dods atoned for his embarrassment when he pulled a goal back to make it 2-1.
However Paul Hartley was left red-faced when he missed from the penalty spot for the home side after Ricky Gillies had been sent off in controversial circumstances.
Steven McGarry was recalled to St Mirren's starting line-up for their game at St Johnstone in place of the injured Graham Fenton but it was the Perth side who enjoyed the first attack of the game.
Momo Sylla took the ball round Scott Walker before unleashing a shot but his effort fell just wide after five minutes.
Three minutes later St Johnstone should have opened the scoring when Nick Dasovic dispossessed Sergei Baltacha.
The Canadian's shot looked goalbound and goalkeeper Ludovic Roy was well beaten but the ball slid inches wide.
The Paisley side's first chance of the game came after ten minutes when Stephen McPhee nodded the ball down to Yardley but the big striker's shot was well saved by goalkeeper Alan Main.
But St Johnstone goalkeeper Alan Main was left helpless just four minutes later.
Gary Bowman's free-kick from the half-way line was met by Yardley in the box and he nodded home his fourth goal of the season.
And with 21 minutes of the game gone Yardley grabbed his second of the day.
McPhee's shot was blocked by Main but the goalkeeper fumbled the ball and Yardley was the first to react to fire home the rebound.
But the home side pulled a goal back after 29 minutes. Sylla's corner picked out the unmarked Dods in front of goal who nodded past Roy.
Just seconds later the Perth side almost drew level from another Sylla corner kick.
This time the ball was met by Jim Weir and the home side were only denied by Iain Nicolson who cleared the ball off the line.
But St Mirren had the chance to extend their lead after 37 minutes. Gillies' shot deflected off Dods and McPhee followed up but the young striker sent the ball over the crossbar.
The game took a turn for the worse for St Mirren after 32 minutes when Gillies was ruled to have brought down Tommy Lovenkrands in the box.
Although the foul looked to have taken place just outside the area referee Dougie McDonald showed Gillies the red card and awarded the spot-kick.
Hartley stepped up for the penalty but smacked the ball of the post.