Livingston's grip on the Petrofac Cup was finally broken as Rangers made it into the semi-finals at a sodden Ibrox.
The holders set out to frustrate Rangers and their tactics looked to be working, with Mark Warburton's men having plenty of possession but little end product.
However, Nicky Clark drilled a low shot from 30 yards into the corner of the net to finally break the deadlock.
The result sets up a home tie with St Mirren in the last four.
Livingston lost 3-0 on their previous visit to Ibrox and with that in mind manager Mark Burchill went for a defensive approach.
The game was merely seconds old when Livingston's Kieran Gibbons crashed into Nathan Oduwa, his studs hitting the ankle of the on-loan Tottenham winger.
The former Aberdeen Under-20s captain was lucky not to be booked and Oduwa even luckier to be able to continue relatively unscathed.
Any notion the tackle would spark a fiery encounter was soon subdued by a laboured approached from both teams - although Livingston's Ben Gordon cleared a James Tavernier header off the line on the quarter-hour mark.
Rangers inevitably dominated possession but found the wall of yellow shirts an insurmountable barrier, with every probing pass through the channels pounced on by the visitors.
Andy Halliday volleyed a weak effort at visiting goalkeeper Marc McCallum as Oduwa lay prone on the turf after Hugo Faria's high elbow was missed by referee Andrew Dallas.
Nicky Law failed to keep Oduwa's chip into the box down with the goal gaping, then Livingston produced a late flurry to end the half.
Liam Buchanan's long drive was easily gathered by Wes Foderingham, before the same player got within inches of Gary Glen's cross, then poked the ball over the bar.
Rangers came out with more purpose after the break. But Halliday's deflected shot over the bar was as close as they could come though in the opening 20 minutes, with McCallum having little to do despite the ball constantly being played into his box.
Clark should have done better when Law's shot was saved and rebounded into his path, but he scooped the ball over the bar.
Law sent another shot wide as the home side's frustration started to increase, but their mood improved when Lee Wallace picked out Clark, who squeezed a low shot from outside the area past McCallum.
Clark should have made it two in the closing stages with a close-range header, but put it well wide.
Rangers manager Mark Warburton: "I thought we dominated possession. Things went on out there that we have to learn from. It was frustrating tonight, I have to say.
"All credit to the players, they got their reward in the end."
Livingston manager Mark Burchill: "Did any of my players get sent off? Well, I'm happy with that.
"It's a cup tie, two teams are trying to win, there's a referee in charge. He's the boss.
"It's a very, very difficult job being a referee. The first tackle from a Rangers player should have been a yellow card and he let that go, so then you have to let a few more go. It's a difficult job and I thought he handled it well."
- 16HallidayBooked at 70mins
- 10OduwaSubstituted forClarkat 45'minutesBooked at 79mins
- 33WaghornBooked at 45mins
- 14GallagherBooked at 27mins
- 6GordonBooked at 63mins
- 2MillenSubstituted forGeorgievat 85'minutes
- 8da Encarnação Pires FariaBooked at 67mins
- 16GibbonsBooked at 70mins
- 31GlenBooked at 74minsSubstituted forCurrieat 86'minutes
- 19BuchananSubstituted forSheerinat 77'minutes
- Andrew Dallas
- Shots on Target