Stenhousemuir could have gone in front after only four minutes when a Craig Menzies through ball unlocked the defence but McGrillen's attempted lob fell wide of the stranded Kieron Renton's right-hand post.
Renton was called into action nine minutes later when he got down smartly at his near post to block a low drive from McGrillen after a quick free-kick by John-Paul McBride created the opening.
McBride was adding a creative edge to the play and Elgin keeper Renton had to race off his line to prevent the former Celtic man from playing in Joe Savage after an interchange between the two players.
After the opening attacks the match settled into a midfield battle with yellow cards for David Hind and John McKeown the only real incidents of note as neither side recorded a single shot on target in the final half hour of the opening period.
City's half-time team talk paid dividends as the home team found a way to exploit the visitors 4-3-3 formation by utilising the wide midfield areas.
Eight minutes after the restart Fraser Bremner managed to set Martin Johnstone clear at the second attempt and the former Cove Rangers striker made no mistake by side-footing home from the edge of the box.
There was a warning for Elgin City in the 67th minute when another swiftly taken McBride free-kick was laid back by McGrillen for Colin Cramb but he side-footed over the bar from 15 yards.
Within a minute there were muted penalty claims at the other end when Hugh Dickson went down while challenging for Jamie McKenzie's free-kick but they were dismissed by referee Mike Ritchie.
Stenhousemuir were back on level terms with 20 minutes remaining with Cramb nodding a McGrillen corner beyond Renton at the near post.
Despite Elgin going close through Mark Booth and Johnston, Stenny stung the home side with a winner five minutes from time.
McBride was the creator with a neat ball inside the full-back which McGrillen curled around Renton.
City's luck was compounded when McKenzie was shown a straight red for swinging and elbow at McGrillen in the dying moments.