Anthony Quinn scored for the Spiders in between headed efforts from Boyd, as Rangers set up a clash with Inverness Caledonian Thistle in the next round.
The opener came on seven minutes when Boyd powered his header into the roof of the net from six yards following a pinpoint right-wing cross from Nicky Law.
Boyd had a shot saved from 20 yards as Rangers probed for a second but they had lost their early edge and the amateurs got a foot hold in the game without threatening.
But they were gifted an equaliser in the 31st minute when Steve Simonsen came way off his line in an attempt to catch Darren Miller’s free-kick from just inside the Rangers half.
Rangers netted the winner on 53 minutes when Arnold Peralta latched on to Lee McCulloch’s blocked shot and lifted the ball into the six-yard box for Boyd to nod home.