Annan might have taken the lead inside five minutes when Chris Jardine fired a bouncing pass towards the Rangers goal, but Neil Alexander was on hand to gather the possession as the home side made the most of the early running.
Rangers' first real chance arrived after seven minutes when Andrew Little struck an effort from outside the penalty area, but Alex Mitchell palmed the danger to safety as the away side started to gain a foothold in proceedings.
Rangers had a chance to test Mitchell after 15 minutes when Templeton stood over a free kick just outside the penalty area, but his effort was high and wide of the stands.
Both sides had chances as the half developed with Michael Daley coming close for the home side, but Templeton put Rangers ahead with a floating effort over the head of Mitchell after 25 minutes.
Rangers came close to taking the lead moments into the second period when Robbie Crawford struck an effort from distance, but it just moved past the post.
It was not all one-way traffic, however, and Stephen Sloan fizzed an effort wide of Alexander's post with 52 minutes on the clock.
Crawford again came close just before the hour mark with a powerful strike from outside the penalty area, but it took a deflection on its way behind for a corner, which was scrambled clear with some desperate defending.
Crawford eventually moved Rangers ahead moments later, however, when he ghosted into the penalty area before thumping his effort past Mitchell.
Chances remained few and far between in the latter stages of the match with a host of substitutions and free kicks interrupting the flow of proceedings.
There was time for late drama, however, when Templeton's effort deflected into the bottom corner to secure all three points for Rangers.
The result has extended Rangers' lead at the top of the Scottish Third Division to 18 points. Meanwhile, Annan remain in sixth position.