The Ibrox side were on the verge of dropping points for the third time in four Premiership fixtures since the winter break until on-loan Genk playmaker marked his first starting appearance with an 84th minute winning goal.
It was a crucial contribution which prevented Rangers falling further behind champions Celtic at the top of the table.
It was also an agonising conclusion to the contest for Hibs who had taken the lead through captain Paul Hanlon and then, after George Edmundson’s equaliser, had defended manfully in a backs-to-the-wall second half.
Gerrard made three changes to his side in a bid to arrest their recent sequence of blunt performances, with captain James Tavernier, Edmundson and Hagi replacing Matt Polster, Nikola Katic and Glen Kamara.
The return of Tavernier after minor stomach surgery was especially welcome for the hosts who have missed the additional attacking outlet provided by their right-back.
He duly created Rangers’ first opening of the night after just three minutes, his through ball playing in Alfredo Morelos who forced a fine save from Ofir Marciano.
But that early promise for the home support of a sharper and more vibrant display from their team quickly dissipated.
With Hagi being effectively policed by Steven Whittaker, back in the Hibs starting line-up in a holding midfield role, the Romanian international initially struggled to deliver the flair and creativity Gerrard is seeking from last week’s deadline day signing. He never stopped trying to make things happen, however, and his perseverance was eventually rewarded with his dramatic late winner.
The visitors had asked questions of the Rangers defence in the early stages and Allan McGregor was called into action in the 12th minute when he made a smart block to keep out Joe Newell’s close range shot, a clever reverse pass from Scott Allan having created the opening.
Martin Boyle was ensuring Tavernier would have plenty of defending to do and the Australian international cut in from the left beyond the full-back to get away a shot which was safely held by McGregor.
Rangers found openings hard to come by at the other end, their play in the attacking third lacking variety or incision. Morelos battled hard to make an impact and sent a snapshot wide of Marciano’s left hand post just before the half hour mark.
Edmundson collected the first booking of the contest with a late challenge on Whittaker, providing Hibs with the free-kick which saw them take the lead 10 minutes before half-time.
Allan delivered it from the right and after Christian Doidge touched it on, McGregor lost out in an aerial challenge with his former team-mate Whittaker. The ball broke to Hanlon who slammed it into the unguarded net from close range.
Marciano held another shot from Morelos as Rangers tried to respond quickly and their frustration grew when Scott Arfield dragged an effort wide from around 12 yards after Joe Aribo adeptly laid off a Tavernier cross.
But just as Rangers looked set to leave the field at the interval to a chorus of disgruntlement from their fans, they drew level in stoppage time. Hanlon conceded a free-kick wide on Rangers right with a foul on Morelos.
Tavernier swept the ball into the penalty area where Edmundson saw his first effort blocked but reacted sharply to seize upon the loose ball and sweep a fine left foot finish beyond Marciano low to the goalkeeper’s left.
Rangers carried a far greater intensity at the start of the second half as they looked to build some momentum and they almost took the lead less than a minute after the resumption when Hagi volleyed narrowly wide from a Borna Barisic cross.
It sparked the first period of sustained attacking play of the night from Gerrard’s side as Marciano next made a fine reaction save to keep out a close range flicked effort from Aribo.
The Nigerian international was unlucky on that occasion but wasteful with his next opportunity, scooping a shot over from inside the six yard box with the goal at his mercy.
Hibs were being hemmed into their defensive third and Marciano came to their rescue again with another excellent save to deny Morelos. When the big Israeli was then beaten by Edmundson’s header from a Barisic corner, he was bailed out by defender Adam Jackson who cleared off the line.
Hibs looked set to hold out and deliver another damaging blow to Rangers’ hopes of catching Celtic until Hagi stepped up to grab the headlines.
Latching onto a Connor Goldson header, he displayed good composure to guide a right foot shot across Marciano into the right hand corner of the goalkeeper’s net.