Kenny Deuchar's second-half goal booked Gretna's place in the Scottish Cup semi-final - the first Second Division team to do so since 1982.
Gretna boss Rowan Alexander (right) celebrates the famous win
St Mirren's Charlie Adam came the closest to breaking the deadlock in the first half when his shot from 25 yards was tipped over by Alan Main.
Deuchar headed Gretna in front from Gavin Skelton's second-half corner.
John Sutton missed a late chance for Saints when he dragged his shot wide, after good work from Simon Lappin.
St Mirren were unchanged while the Black and Whites brought in experienced defenders Chris Innes and Jamie McQuilken for cup-tied Martin Canning and Allan Jenkins.
The Paisley club used the wind at their backs to launch the ball forward whenever they could and one kick-out from Tony Bullock broke for Charlie Adam on the edge of the box but he shot just wide in the 12th minute.
Adam came equally close from 50 yards five minutes later but his effort sailed just past the posts.
Gretna's first chance fell for James Grady but he headed McQuilken's cross wide from 10 yards.
Gretna came back into it and Skelton came close when his shot from 20 yards dipped just over.
A high ball caught in the wind at the other end and Grady laid it off to Skelton, who shot just wide from the edge of the area.
Adam came close in the 32nd minute when he ran at the heart of the home defence and shot from 25 yards, only to see keeper Alan Main push it over the top corner.
Grady nearly broke the deadlock after the break with a piece of magic in the box.
He flipped the ball outside a defender and volleyed it towards goal but Bullock tipped it over superbly.
The First Division leaders slowly emerged from their enforced exile from the Gretna half and almost had a chance, when Main dropped a Simon Lappin free-kick.
But Gretna went up the park and Skelton launched a 30-yard effort towards goal which Bullock turned over.
Skelton took the corner and Deuchar rose at the near post to glance the ball into the far corner.
St Mirren finished with three men up front when Billy Mehmet came on to join fellow sub Mark Corcoran and John Sutton.
Sutton missed his best chance in the last minute when he dragged the ball wide after Lappin had played him in.
Gretna: Main, Birch, Nicholls, Tosh, Townsley, Innes, McQuilken, McGuffie, Deuchar, Grady, Skelton. Subs Not Used: Mathieson, Shields, Baldacchino, McBride, Sloan.
Goals: Deuchar 73.
St Mirren: Bullock, van Zanten, Maxwell (Mehmet 81), Millen, McGowne, Potter, Anderson (Murray 60), Lappin, Sutton, Adam, Kean (Corcoran 68). Subs Not Used: Smith, Reid.
Ref: S Dougal