Rangers booked their spot in the last eight of the Premier Sports Cup - but it was a far from convincing victory over Alloa Athletic.
The Light Blues ran out 4-2 winners thanks to Nedim Bajrami's stunner, an Emmanuel Fernandez header, a penalty from skipper James Tavernier and a last minute low drive from sub Findlay Curtis.
Joe Rothwell's own goal levelled for the lower league visitors midway through the first half after a moment of defending to forget for the home side.
A VAR check sent referee Dan McFarlane to the monitor and that allowed Tavernier to add to Fernandez's goal but Scott Taggart tapped home from close-range after an effort came off Liam Kelly's crossbar to give the League One side renewed hope and send the travelling fans wild.
But Curtis climbed off the bench to fire home a fourth for the hosts in the final seconds of the 90 as Rangers got a much needed win, but questions are likely to be asked once more.
Russell Martin rang the chances for this one. Ten in total from the off.
Mikey Moore was in for his debut with Thelo Aasgaard also making his bow from the bench.
Hamza Igamane also returned from injury and picked up some much needed minutes ahead of the crucial two-legged showdown with Club Brugge in the play-off round of Champions League with a £40million jackpot on the line.
The games are coming thick and fast for the Light Blues but victory in this one brings a first domestic competitive win for boss Martin after back to back Premiership draws.
Key Events
'There's still a lot more to come from me and the club' - Joe Rothwell
Joe Rothwell admitted it is all about progression in the cup.
Rangers booked a quarter-final spot and will face one of Livingston or Hibs after seeing off League One Alloa.
The summer recruit told Premier Sports that there is much more to come from both him and Russell Martin's new look team
It was just about winning the game and progressing to the next round. Thankfully we've managed to do that.
Obviously we'd have liked to have seen the game off and put it to bed earlier, but we got the fourth in the end.
There's still a lot more to come from me and the club. I feel I'm growing each game.
Russell Martin speaks post-match
Russell Martin admits Rangers still have work to do in EVERY department.
Speaking to BBC Scotland after the win over Alloa he vowed his side will keep striving to improve while he hailed Alloa's efforts at Ibrox.
We scored four goals, should score more but I'm pleased we got guys on the pitch for the first time properly here.
With 10 changes, it's not going to look as fluid and clean as it should, but so many of them will be in a better place than they were at the start.
I'm pleased for Emmanuel Fernandez. He has a lot of potential and good attributes. It's a good start for him.
There's work to do in every department. I don't think we learned anything new there. Credit to Alloa - they were great. We'll keep striving to improve.
Last eight draw in full
Kilmarnock or Dundee United vs St Mirren
Partick Thistle vs Celtic
Rangers vs Livingston or Hibs
Aberdeen vs Motherwell
Quarter-final draw is set!
Rangers will be at home in the last eight as they face one of Livingston or Hibs.
5 talking points
Rangers booked their spot in the last eight - but it wasn't without a scare from League One Alloa at Ibrox.
Check out our man Fraser Wilson's 5 talking points from the last 16 showdown.
FULL-TIME
Rangers 4 Alloa 2
The Light Blues are into the hat for the quarter-final draw.
But it wasn't the most convincing evening for the Ibrox side.
Injury time
The fourth official holds up the board as we enter the final seconds of the game.
GOALLL!!!
A sigh of relief for Russell Martin you can bet.
It's a fourth goal for his troops and that should be game over.
Kieran Dowell does brilliant to play in Findlay Curtis and he finishes superbly.
His low effort leaves Alloa No1 McFarlane with no chance.
Rangers 4 Alloa 2
Late throw of the dice?
Luke Donnelly is on for the visitors for the final five minutes with Kurtis Roberts replaced.
Ropey Rangers clinging on
Some how Rangers have managed to get themselves into a situation where they are yet again anxiously trying to see out a game they should have had wrapped up long ago.
There's a sense of alarm spreading round Ibrox every time the Wasps launch a ball forward to Conor Sammon and the fans have every right to be fearful given the struggles centre-backs Manny Fernandez and Nasser Djiga have had dealing with the former Ireland striker.
You have to wonder what happen on Tuesday if Gers prove to be quite so accomodating to Club Brugge...
Huge 10 minutes to come!
Wow.
This was not in the script at Ibrox.
Alloa's tails are up going into the final ten minutes.
I wonder what is going through the mind of Russell Martin on the touchline.
GOALL!!
This one isn't over yet!
The visitors pull a goal back with just over ten minutes to play.
A dangerous cross is won at the back post and Scott Taggart is on hand to tap in from one-yard out.
Rangers 3 Alloa 2
Sore one
Connor Barron is in the book as he goes flying in.
It looked a painful one for Kurtis Roberts.
The referee played the intial advantage before coming back to book the midfielder.
Dowell denied
Kieran Dowell is the latest to try his luck.
But McFarlane once again makes a smart low save.
He's been busy this evening.
That will do it...
That should be Rangers through to the quarter-finals but it's hardly been a display that will convince Russell Martin's many doubters.
They've looked more controlled in the second half and have shown a slight increase in intent - but there 's still not been much of a rise in the quality of the end product.
Too often, it's the extra touches and moments when passes have not quite been on the money that have contributed to the clunky nature of the performance.
But the fans will be eager to see if the introduction of Thelo Aasgaard and Hamza Igamane can make a difference.
Moore's off now and he can be happy enough with his debut. He had a few bright moments early on but it was tough going finding space with Alloa sitting so deep. Martin will hope he'll do more the wide open acres Brugge are bound to afford his side on Tuesday.
Triple change for Rangers
Russell Martin turns to his bench to freshen things up.
Connor Barron, Hamaza Igamane and Thelo Aasgaard are on.
Joe Rothwell, Danilo and Mikey Moore make way.
It's much needed minutes for Igamane and Aasgaard who also makes his debut for the club.
GOALLL!!!
James Tavernier makes no mistake from the spot.
The keeper guesses right, but the skipper turns home via the post.
Rangers 3 Alloa 1
PENALTY!
The referee points to the spot after a review.
Oscar Cortes sees his effort blocked by a hand as he went to tap in.
Cameron O'Donnell is penalised and issued a yellow card.
Great block!
Liam McFarlane produces a big save from Bajrami and the ball looks like it would drop to Cortes for a tap in.
But it is a stunning piece of defending to turn the ball away for a corner.
Close!
Nedim Bajrami goes for a stunning half volley but it drops just wide.
The ball dropped to him after it looked to be put into his path by Danilo via his shoulder.
Alloa changes
Luke Rankin makes way for Connor Sammon and Cameron O'Donnell is on for Kalvin Orsi.
55 played
Similar to the first half it is mainly all Rangers with the ball.
But the most important stat is the scoreline and there is still only one goal between the two sides.
Two half chances
Danilo has another chance.
He is in the six-yard box and tries the fancy back heel flick after a low cross from Oscar Cortes.
But it is straight at McFarlane who keeps it out.
Inventive from the striker but just missing the direction away from the middle of the goal.
Moments later James Tavernier tries his luck but McFarlane gathers with the sun in his eyes.
Tav stays left
James Tavernier came on as a late chance in the first half for Bailey Rice.
He took up the left back position for the final seconds of the half but he has remained there.
Max Aarons sticks to the right side.
Bored Bears
Rangers lead at the break but you can hardly say the fans here have witnessed a sudden breakout of style.
The punters were warned that Russball would sometimes leave them bored amid a blizzard of passes.
But there's still a cluncky, pedestrian vibe to this Gers line-up.
The fans are crying out for some pace and intensity to their team's performance but the Light Blues appear a long way off being able to produce the high octane stuff they're looking for.