Dale Carrick had put David Hopkin’s side ahead in 30 minutes but Lewis Morgan levelled then Jackson Longridge deflected the ball into his own net before an Ian McShane penalty sealed it.
As usual Morgan was the pick of the bunch in a creative sense, but Saints had terrific performers throughout the team.
There are few more talented young players in Scotland than Morgan and his sheer pace was an issue for Livingston all night.
However, it was to be early in the second half that he really hurt them.
Morgan left Declan Gallagher for dead with a burst down the left side to create the space he needed for what seemed an ideal cross in 14 minutes but Kyle Magennis was unable to get either direction or purchase on his header as it flew wide.
It sparked a period of concerted St Mirren pressure and Neil Alexander had to be alert to hold Gavin Reilly’s shot a minute later.
Then the veteran goalkeeper made an even better save in 19 minutes when he got down well to his right to push Cammy Smith’s effort wide.
The Paisley side did have the ball in the net two minutes later when McShane’s swerving corner came down on top of Alexander, but it was clearly a foul as Smith bundled into the Livingston keeper.
Hopkin’s side are nothing if not resilient and having re-established a foothold in the game, they stunned the Paisley public by taking the lead in 30 minutes.
Keaghan Jacobs hit a free-kick to the right side of the box that was headed back across goal by Gallagher.
Josh Mullin was there first and he hit an early left-foot shot that Craig Samson could not hold and Carrick reacted quickest to slam home the rebound.
It may have been against the run of play but the West Lothian side again proved what tough characters they are.
However, Hopkin’s men enjoyed an incredible stroke of luck three minutes before half-time. Alexander was caught out by Adam Eckersley’s cross from the left which he thought was drifting over the bar but it dropped behind him, hit the right post then his heel and was quickly cleared by Longridge just before Smith got there.
St Mirren’s imagination from corners had been lacking with Morgan and McShane all too often not getting past the first defender.
However, when Morgan mixed things up in 51 minutes it paid off royally.
He worked a short corner with Liam Smith on the right, then burst into the box to fire a left-foot shot that Alexander could not prevent from going into the left corner.
Then Morgan was involved again as Saints grabbed the second goal they so badly wanted in 67 minutes.
He drove in from the left side and was thinking about a shot when Eckersley nicked it off his toe, burst forward and slammed a left-foot shot that seemed to hit Gallagher and then Longridge before creeping into the net at the left post,
Jack Ross celebrated wildly on the touchline and it was a bit too exuberant for Hopkin, who confronted the Saints boss and the two were warned by referee Gavin Duncan.
Then with 12 minutes to go St Mirren made certain of victory when they won a penalty after Jack Baird was tripped by Alan Lithgow and McShane made no mistake from the spot.