The tie looked like it was heading for a replay after Lee McCulloch failed to convert from the penalty spot and the Light Blues struggled to break down a Bairns side who played the last half hour with 10 men.
But Law grabbed the opener with a minute of the regulation 90 to go and Templeton doubled the advantage deep into injury time as Ally McCoist's men left it late to book their place in the next round.
Rangers made one change from the side who defeated Arbroath in Scottish League One on Monday night, with Fraser Aird dropping to the bench in favour of Arnold Peralta.
Before the match kicked off, a minute's silence was impeccably observed in respect of those affected by Friday night's helicopter crash in Glasgow.
Once the tie was under way, Ian Black tried his luck with an effort that he dragged wide of target as the visitors tried to put their hosts under some early pressure.
A scramble in the six-yard box followed but no-one was able to produce a clean shot at goal before Falkirk goalkeeper Michael McGovern claimed possession of the ball.
Rangers were threatening again when Peralta's corner found McCulloch six yards out but he could not keep his header down and on target.
McGovern was then alert to claim a Jon Daly header and prevent the Irishman from adding to his 17 goals so far this season.
The Falkirk goalkeeper came to the rescue again when he raced off his line to block a Lee Wallace effort after the left-back found himself one on one with McGovern.
At the other end, Phil Roberts tested Cammy Bell with a shot from distance that failed to trouble the Rangers goalkeeper, moments after the striker had picked up the first booking for a challenge on Peralta.
Roberts was quickly followed into referee Brian Colvin's book by Mark Millar, who was cautioned on the stroke of half-time for a late sliding tackle on Black.
Wallace, who had the best chance of the first half, had another decent opportunity to open the scoring shortly after the restart.
He raced on to a Law pass and unleashed a shot from just inside the box that dipped over the crossbar, with McGovern untroubled on this occasion.
Rangers were handed an opportunity to open the scoring on 58 minutes when the referee pointed to the spot after David McCracken was shown a straight red card for hauling down Nicky Clark in the box.
McCulloch stepped up for the penalty but the skipper was denied the opener by a decent save from McGovern.
Law steered the ball back towards goal and McCulloch flicked into the back of the net, but the offside flag was already raised.
Peralta and Clark were then replaced by Aird and Templeton respectively as Rangers shuffled their pack in a desperate bid to find a way past the Bairns.
Aird was denied by the woodwork with his first touch of the ball when his ferocious shot cracked off the crossbar and the danger was cleared.
The breakthrough finally came with 89 minutes on the clock when a Black free-kick broke for Law and he lashed home.
Templeton then ensured there was no way back for Falkirk when he collected from Aird and dispatched a shot beyond the grasp of McGovern.
- Sports & Recreation
- Lee McCulloch
- Fraser Aird