Paul McGowan was the hat-trick hero for the visitors, with Paul McQuade grabbing a double and Aaron Mooy grabbing a confidence-boosting goal, before Graeme Sharp bagged a late consolation for the hosts.
Danny Lennon’s side travelled to the north-east just days after a Clydesdale Bank Premier League defeat at Aberdeen, and showed two changes from the side that went down 2-0 to the Dons.
Sean Lynch and Craig Dargo were the duo dropping out, with Mooy and McQuade replacing them.
Peterhead were missing the services of wily hitman Martin Bavidge due to work commitments.
Former Buddies striker Dennis Wyness was handed his first start since recovering from a hamstring injury, and Stuart Anderson was preferred in midfield to Nicky Clark.
Peterhead striker Dave Ross missed a glorious chance after 20 minutes when Jim Goodwin’s sloppy pass allowed the striker through on goal, but Paul Gallacher spread himself to turn the effort round the post .
The hosts would regret that missed opportunity two minutes later as the visitors went ahead. On-loan Watford wing-back Jure Travner swung in a teasing ball from the left and McGowan had the simplest of tasks to nod home from six yards.
That was St Mirren’s first goal since Steven Thomson struck twice against Inverness on Boxing Day and silenced Balmoor’s largest crowd of the season.
They did not have long to wait for a second as the diminutive McGowan turned provider, twisting and turning to pull the ball across the goal from the byline, and Mooy was perfectly placed to turn home from close range.
A poor 11-minute spell for the Blue Toon was capped as Lennon’s men all but sealed their place in the fifth round.
Again Travner delivered from the left, this time picking out McGowan with a low ball. Despite the presence of Callum Macdonald, McGowan was able to turn and pick his spot low to John Bateman’s left.
McQuade added a fourth on the stroke of half-time. The former Cowdenbeath man was given far too much time to turn in the area following a corner from the left and, although Bateman got a touch, he could only watch on in horror as the ball squirmed over the line.
Just two minutes after the restart the Buddies netted a fifth, and it was that man McGowan who notched his hat-trick.
Again the Peterhead defence were slack, and McGowan had room to turn and confidently fire past the beleaguered Bateman.
They were not finished there, though, and took full advantage when Anderson made a meal of things outside his own area, McQuade bagging his second of the night with a fine curling finish.
The home side took charge in the dying stages, and bagged a deserved consolation a minute from the end.
Substitutes Clark and Conor Gethins were involved in the build-up, with the impressive Clark – son of former Rangers man Sandy – teeing up Ryan Strachan for a shot at goal.
His effort was blocked, but Sharp raced in to drill the ball home to lift the spirits of the home support.