Peterhead ended their two-game losing run to climb back into the promotion places after victory over Berwick.
Blue Toon striker Rory McAllister was denied by Rangers goalkeeper Youssef Bejaoui early on before Chris Townsley's header was parried by Paul Jarvie at the other end.
The visitors went close again in when Philip Addison tested Jarvie from distance before match-winner Stephen Maguire made the decisive contribution nine minutes after replacing Robert Winters.
The 25-year-old striker found space six yards out to turn Bryan Deasley's pass into the bottom left-hand corner.
Paul Hutchinson's men were unable to find a response as they slipped to a third consecutive away league defeat.
Jarvie, Ross Smith (Deasley 56), Harding, MacDonald, Noble, Redman, Strachan, Scott Ross, McLaughlin, McAllister (Kelly 86), Winters (Maguire 68). Subs Not Used: McCallum, Fitzgerald.
Bejaoui, Jacobs, Townsley, Brydon, Hoskins, McDonald, Currie (Gielty 81), Janczyk, Notman, Noble (McLaren 58), Addison (Lavery 59). Subs Not Used: McCaldon, McLean.
Kevin Graham (Scotland).