Rangers survived a second-half onslaught from Inverness to extend their Scottish Premier League lead over Celtic to seven points.
Carlos Bocanegra slid in to put the home side ahead on 55 minutes after Nikica Jelavic chested the ball down.
Andrew Shinnie levelled from close range for Inverness controversially, as Jelavic was injured in the build-up.
The visitors were well on top, but Kyle Lafferty's 18-yard effort on 83 minutes sealed victory.
Ally McCoist's men threatened for the first time after 10 minutes. Gregg Wylde's classy cross found the head of defender Steven Whittaker eight yards out, only for Inverness goalkeeper Ryan Esson to spring to his right and pull off a stunning save.
However, the Highland outfit were not fazed and set about silencing the Ibrox crowd. Lee Cox accelerated away from Bocanegra and drove the ball across the face of the goal, but Kyle Bartley was on hand to clear for the home side.
There then came strong Inverness appeals for a penalty midway through the opening 45 minutes as the ball hit the hand of Jelavic in the box from Richie Foran's flick-on, but referee Bobby Madden was not persuaded.
Rangers manager McCoist brought on Lee McCulloch for Maurice Edu at half-time to shake up the midfield. He was forced into another change minutes later when Alejandro Bedoya was replaced by Lafferty after appearing to pick up an injury.
There was a second appeal for a penalty from the visitors when striker Billy McKay claimed he was held by Bartley inside the Rangers penalty area.
However, they were again denied a spot-kick and the league leaders made the most of their reprieve.
Lee Wallace sent a ball to the back post which Jelavic chested down and knocked into the path of Bocanegra, who stole in in at the angle of the six-yard box to put Rangers ahead.
Sasa Papac came agonisingly close to doubling his side's advantage as he got the break of the ball from a challenge on Jelavic and smashed a left-foot shot from 30 yards against Esson's crossbar.
That changed the flow of the game as Inverness were to equalise in controversial circumstances soon after.
Jelavic was injured in a challenge from Roman Golobart but the game raged on and both sides had chances to put the ball out of play.
Andrew Shinnie converted from close range after some smart work from Gregory Tade and it was game on.
The action was frenetic in the second period and Caledonian Thistle had three great chances to take three points.
Firstly, McKay rounded Allan McGregor but could only hit his shot off outside of the post, before Lee Wallace cleared off the line from Jonny Hayes.
McKay then had another opportunity to beat the Rangers goalkeeper but could only shoot straight at the Scotland international.
Inverness were made to pay a heavy price for those missed opportunities as Lafferty conjured up an 18-yard strike out of nothing to shoot the Light Blues ahead and leave the Highlanders heartbroken.