Hearts' Rudi Skacel hit a treble as his 10-man side rallied from 2-1 down to go third in the Scottish Premier League.
Marius Zaliukas headed the Tynecastle team ahead after 52 seconds, but then saw red as he fouled Paul McGowan for a penalty and the St Mirren man converted.
Steven Thompson nodded the visitors in front but Skacel's 30-yarder levelled the scores once more.
The Czech unleashed two more long-range goals before John Sutton hit a fifth.
Hearts had gone ahead early on after Scott Robinson's dangerous effort into the box had to be cleared for a corner. Ian Black launched his kick into the penalty area and Zaliukas escaped marker Marc McAusland to power a header past St Mirren keeper Craig Samson.
However, within 12 minutes Zaliukas turned sinner when he took out McGowan as he was about to pull the trigger for Saints. Referee Steven McLean flourished the red card to the captain and McGowan dusted himself down to beat Marian Kello from the resultant penalty and level the scores.
St Mirren made the Tynecastle side pay on 19 minutes. Thompson connected with McAusland's cross from the right to beat Adrian Mrowiec and powered home a clever header over the keeper from 18 yards.
Incredibly, 10-man Hearts levelled four minutes later. St Mirren appealed for a free kick for an apparent Skacel push on Graham Carey after they failed to clear a corner, but play was waved on and the Czech thumped home a 30-yard left-foot thunderbolt.
The tempo of the game began to slow following the frenetic opening quarter and the teams reached the interval level, as the flurry of chances eventually dried up.
Black was booked for an attempted trip on McGowan and Hearts boss Paulo Sergio was spoken to by referee McLean after leaving his technical area to protest against the decision.
Elliott blasted over as St Mirren scrambled and failed to clear a Black free-kick into the area before Kello parried a Carey drive from the left edge of the box.
Skacel restored Hearts' lead with his second after 64 minutes. Jamie Hamill's long throw found John Sutton, who laid the ball off and Skacel made space before firing a shot into the bottom corner.
Five minutes later Skacel completed his hat-trick. Black won the ball and Skacel found space to unleash another left-shoot shot across St Mirren keeper Craig Samson.
Amazingly, Hearts hit a fifth through Sutton. Danny Lennon's men were penalised for a handled pass-back and, from the resultant free kick, Black laid the ball off to the English striker to shoot into the top corner and seal a remarkable three points.