Leighton Clarkson and Papa Gueye had the home side 2-0 ahead at the break, with Rangers reduced to 10-men after Ross McCausland was sent off.
Hamza Igamane grabbed one back for Ferguson’s men early in the second-half but it was Hagi who came up with a moment of magic in injury time to find the equaliser with a superb strike.
There were nine changes from Thursday’s UEFA Europa League quarter-final against Athletic Club, with only Liam Kelly and Robin Propper retaining their places in the starting XI.
Ferguson freshened up the squad, giving opportunities to a number of players. Among those were academy graduate Findlay Curtis who made his first senior start for the club.
Rangers started with Liam Kelly in goal behind Ross McCausland, Clinton Nsiala, Robin Propper, Rafa Fernandes and Curtis. Connor Barron captained the side in midfield, alongside Nedim Bajrami, while Oscar Cortes, Danilo and Hamza Igamane provided the attack.
There was little action of note in the opening period at Pittodrie, with a couple of half-chances for either side in the first 10 minutes as Pape Gueye fired wide for the home side, before Oscar Cotes saw a shot deflected wide after a good combination move down the left.
With 18 minutes played at Pittodrie, Shayden Morris had the best chance of the match so far as he latched on the end of a ball from Topi Keskinen to turn in the box but his strike across goal flashed wide of Kelly’s right-hand post.
Ferguson was forced into a change midway through the half as Rafa Fernandes, on his first league start for the club, was unable to continue, and captain James Tavernier came off the bench in his place.
The home side were threatening, and Mats Knoester should have had them ahead as he met Graeme Shinnie’s cross inside the area, but was able to keep his left-footed effort down as it rose high over the bar from close range.
With half an hour played, it was Aberdeen who had the opening goal from a set-piece. Awarded a free-kick on the corner of the box, Leighton Clarkson stepped up, and the midfielder curled the ball high into the back of the net.
Morris came inches away from adding a second as another strike across goal from the winger bounced just wide of the post before Doohan held an Igamane effort as Rangers looked for a response before the break.
There was disaster for Rangers with 40 minutes on the clock as Rangers were reduced to 10-men as Ross McCausland received a second yellow card for a foul on Keskinen.
Keskinen was causing problems down the left, and minutes after the sending off, again made ground down the flank before cutting inside and getting a shot away but it was just wide.
The home side made the advantage count, and it was 2-0 to Aberdeen with 44 minutes played. Morris provided the delivery from the right after he got the better of Findlay Curtis to send the ball into the box and Papa Gueye was on hand to guide home a low finish.
Hamza Igamane had the ball in the net in first-half injury time, but a VAR check confirmed the ball had gone out of play in the build-up.
Ferguson turned to his bench at half-time with Jefte and Diomande introduced in place of Oscar Cortes and Danilo.
Less than five minutes into the second-half Rangers had the goal back they desired. A Liam Kelly goal kick was flicked into the path of Hamza Igamane and the striker controlled it well before finding an opportunity to shoot. It was a powerful left-
There was a huge chance for Aberdeen to increase their lead as Kevin Nisbet came inches wide with a curling strike after a cut back from the byline.
Dessers almost had an opportunity from a header as he got on the end of a lovely delivery from Diomande, but Doohan did enough to contest with the Rangers striker and the ball went over the bar.
The home side thought they had a third with 88 minutes on the clock as Kevin Nisbet found the back of the net from a Leighton Clarkson free-kick but it was disallowed by VAR for a handball in the build-up.
It was Rangers who found the equaliser in the final stages of the match. Cyriel Dessers hit the post with a strike before Jefte played it to Ianis and it was a superb hit from the midfielder to secure a point.
RANGERS: Kelly, Nsiala, Propper, Fernandes (Tavernier, 20), McCausland, Barron, Bajrami (Hagi, 68), Cortes (Jefte, 46), Curtis (Dessers, 75), Danilo (Diomande, 46), Igamane
Subs: Butland, Souttar, Hutton, McCallion.
Aberdeen: Doohan, Shinnie, Knoester, Nisbet, Clarkson, Gueye (Sokler, 59), Palaversa (Devlin, 64), Morris (Okkels, 59), Dorrington, Jensen, Keskinen (Dabbagh, 64).
Subs: Ritchie, Polvara, Milne, Boyd, Ambrose.