Promoted Livingston stunned Rangers to consign Steven Gerrard to just his second defeat in 18 games as manager of the Ibrox club.
Dolly Menga’s strike proved to be the difference as Gary Holt’s side moved level with Hibernian in second.
Gerrard’s side remain without an away win in the Premiership this season and face leaders Hearts, who they trail by eight points, next Sunday.
Before then, Rangers host Rapid Vienna in the Europa League on Thursday.
Livingston, meanwhile, extend their unbeaten run in the division to six games, with head coach Holt still to taste defeat since replacing Kenny Miler last month.
Livingston miss chances against blunt visitors
Holt’s team should have been ahead long before they scored, with their directness causing Rangers all manner of problems.
Scott Robinson broke through but dragged his effort across the face of goal, then Alan Lithgow could only direct his effort wide after sliding in to meet Craig Halkett’s header across goal.
The hosts were content to let Rangers play in front of them, knowing they could trouble the visitors at set pieces. And that was the manner in which the crucial goal came.
Rangers conceded a free-kick and Livingston worked an opening, Declan Gallagher and Robinson combining to set up Menga, who took a touch and scored from the centre of the box.
By that stage, Rangers had dominated possession but had found the home defence impenetrable and goalkeeper Liam Kelly was largely untroubled,
That pattern continued into the second half, though Alfredo Morelos did force a save from Kelly.
Scott Pittman was denied by the feet of Rangers goalkeeper Allan McGregor and Lithgow flicked wide from another Livingston set play.
Crosses continually came into the Livingston box and were continually cleared, while two penalty claims – after Halkett’s challenge on substitute Glenn Middleton, and one for handball – were waved away.
‘Phenomenal’ from Livingston – analysis
BBC Scotland’s Alasdair Lamont at the Tony Macaroni Arena
A phenomenal performance and result for Livingston. To a man, they were excellent, continuing to exceed expectations on this upward trajectory.
Their style of play and personnel has scarcely changed since their return to the top flight, but great credit has to go to Holt for the way he has galvanised the team since his arrival.
He had so many heroes. Captain Halkett was immense, marshalling a superbly-organised defence, while Menga kept Connor Goldson and Joe Worrall on their toes throughout.
Rangers were short of inspiration, though. As good as they have been at times under Gerrard, they fell well short of those standards.
Their final ball was lacking – only once did they cut the home side open – and it is something of a wake-up call for Rangers, who find themselves in mid-table.