Montrose were twice denied late equalisers by the frame of the goal before Robbie Crawford secured the points with virtually the last kick of the game.
Shiels set up Kevin Kyle to put Rangers ahead midway through the second half and then finished off a clinical break to seemingly end the visitors' struggle.
Montrose led for six minutes through Lloyd Young's strike before Lee McCulloch netted a penalty.
But David Gray soon scored a wonderful lob and Garry Wood and Scott Johnston both hit the woodwork.


