A late glancing header from Eggert Jonsson gave Hearts their first win in six matches despite having to battle for over 50 minutes with just 10 men following a red card for midfielder Michael Stewart.
In a hugely disappointing contest, Hearts at least started brightly although the home crowd was soon angered by Saulius Mikoliunas after the unpopular Lithuanian earned a soft free-kick after appearing to slip.
Neither side was managing to create anything of note and only the other team's mistakes led to any goalmouth excitement.
Two mediocre free kicks from Bruno Aguiar somehow worried the home defence and then Hearts goalkeeper Janos Balogh put his own defence under pressure with a miscued clearance.
Mikoliunas finally escaped the booing after 27 minutes when a leg injury forced him off to be replaced by full-back Robbie Neilson, who was making his first appearance since April.
The match suddenly burst into life 10 minutes before the break as Franco Miranda shot fractionally wide for St Mirren from long range before Stewart deservedly saw red after kicking out Hugh Murray.
It seemed as though Stewart might get away with it but referee Mike McCurry correctly sent him packing after consulting the fourth official.
Saints knew they had to use their extra man wisely and finished the first half on top with Dennis Wyness heading over the top from a promising position.
They also began the second period in encouraging fashion as substitute Andy Dorman carved out a chance for Billy Mehmet which the top-scorer scooped inches wide.
Aguiar briefly managed to lift the pressure that was steadily building on the visitors as he tried his luck with a sweet half-volley and a delicate chip but both efforts were off target.
St Mirren also appeared to be struggling despite enjoying an edge in terms of territory and position and it was no real surprise to see manager Gus MacPherson losing finally losing patience and bringing on two strikers Craig Dargo and Jim Hamilton in search of a late winner.
But football can be a cruel game and there proved to be a late twist in the tale for MacPherson and the home supporters as punch drunk Hearts grabbed all three points 11 minutes from the end thanks to Jonsson's precise header from Andy Driver's free-kick.