In what was a typically hard-fought game the Jambos were to take a shock lead through Andrius Velicka after only 15 minutes.
But Gavin Rae was to get his side back into the match after the interval before Barry Ferguson fired home a spectacular overhead kick with 11 minutes left to play.
With Aberdeen drawing with Hibs at Pittodrie today’s win was vitally important to Walter Smith’s side who have take a step closer to securing a potentailly lucrative Champions League place for next season.
The gaffer made three enforced changes to the team that faced St. Mirren two weeks ago with Kevin Thomson, Gavin Rae and Dado Prso all included in the starting eleven due to the loss of Nacho Novo and Charlie Adam to suspension and Chris Burke to illness.
Thomson was asked to play on the left side of midfield and Rae on the right while Dado Prso made a welcome return to the team and put in a tremendous shift alongside Kris Boyd.
With the club’s under-19s currently chasing a league and cup double Smith also rewarded some of the youngsters in the squad by naming Andrew Shinnie, Steven Lennon and Jordan McMillan on the bench.
Hearts’ captain Craig Gordon won the toss prior to the kick-off and, somewhat surprisingly, elected to switch ends which meant that Rangers were shooting toward the Copland Road Stand in the first-half.
Smith’s troops were to start the match in a positive manner and after seven minutes had their first goalscoring opportunity when Dado Prso stole the ball from Karipidis in the right-back position before bearing down on goal.
The Croatian squared the ball to Rae who was tackled brilliantly before Gordon produced a stunning double save from Prso then Boyd.
The complexion of the match was to change entirely, however, on 15 minutes when the Jambos took a surprise lead with a superb goal.
Ghanaian midfielder Laryea Kingston picked the ball up midway in his own half and took the ball 60 yards before feeding it to Velicka on the edge of the 18-yard-box.
The striker took one touch before hammering a low shot across McGregor and celebrating with the visiting support in the away end.
Rangers looked to get back in to the game quickly and Prso gestured wildly at not being awarded a penalty on 20 minutes and the Ibrox faithful were equally disgusted at Iain Brines’ decision.
At the half hour mark it was surprising, to say the least, to see Rangers a goal down on the Ibrox scoreboards as McGregor had yet to make a save. Indeed the only time he had seen the ball was to take it out of the net.
The home side continued to dominate proceedings and Sasa Papac, who had enjoyed an excellent half at left-back, was denied when Gordon once again produced a brilliant save from the Bosnian’s bullet header.
Unfortunately Papac was to take a knock to the head when challenging for the ball with Berra and after several minutes of treatment was taken from the field on a stretcher and replaced by Ian Murray.
Four minutes of injury time was to follow at the end of the half but Rangers were unable to get a goal back with Hearts retaining their slender advantage.
Smith stuck by the same eleven players for the restart and the Gers got themselves back in the game on 51 minutes.
Barry Ferguson fed the ball to Alan Hutton and the in-form right-back skipped by Lee Wallace before playing a delightful cross into the danger area.
Gavin Rae, who looked to be lacking confidence in the opening 45 minutes, stooped to head the ball beyond the reach of Gordon and Ibrox erupted.
Smith moved from his Directors Box seat into the dug-out as his team began to take control of proceedings and on the hour mark it looked as though they could get a much needed winner with Hearts camped in their own half.
On 66 minutes Rangers were awarded a free-kick on the right but Hemdani’s whipped cross was missed by Prso and also Hutton.
But the decisive goal was to arrive on 79 minutes and what a cracker it was.
Prso was instrumental in the move when he showed neat skill on the left before playing a great cross in to the box.
The ball was cleared but Hemdani kept the attack alive by heading to Ferguson and the captain’s acrobatic overhead kick was worth the admission money alone.
The management duo oif Smith and McCoist celebrated with their backroom staff on the sidelines and few would argue that Rangers deserved the win having dominated the majority of the game.
At the end of the day it was a nervy afternoon for the Gers’ supporters having lost an early goal but their heroes showed great character to fight back and getting the win was all that mattered.
Man of the Match – Dado Prso