With 12 minutes remaining, the midfielder set up a fourth-round clash against Falkirk with an 18-yard effort that required a heavy deflection off Josh Meekings.
Chances had been few and far between during a goalless first half, with the best opportunity of the opening 20 minutes falling to Kris Boyd whose 12-yard strike was saved by visiting keeper Dean Brill.
Marley Watkins had a rare shot for Inverness on 35 while Lee McCulloch headed narrowly wide shortly afterwards for the hosts.
The second half began more brightly than the first with Greg Tansey seeing his long-range effort saved by Gers keeper Steve Simonsen.
Billy McKay then missed from close range for Caley, while David Templeton fired wide for Rangers.
But there were real moments of concern for the hosts in stoppage time as a Ryan Christie header was blocked on the line by Ian Black before an offside flag came to their rescue as Gary Warren’s last-gasp header flew past Simonsen.
However, MacLeod’s goal proved to be the difference between the sides as Premiership Inverness slumped to their second defeat in three days.