Substitute Stephen McGinn lifted St Mirren off the foot of the SPL and kept Rangers from taking over at the top.
McGinn had only been on the pitch for five minutes when he cracked home a superb winning goal with just 13 minutes left.
It gave St Mirren their first win over Rangers at Love Street for 22 years and left the Ibrox side shell-shocked.
Allan McGregor was restored to Rangers' starting line-up in goal with Neil Alexander relegated to the bench in Walter Smith's only change.
St Mirren made the brighter start and Dennis Wyness just failed to connect with an early cross from Jack Ross which exposed Rangers.Garry Brady then shot wide after Pedro Mendes had given away a free-kick outside the area with a challenge on Wyness.
But Rangers looked dangerous on the break and a mistake by Gary Mason gave Kevin Thomson a shooting chance but his effort was beaten out by Mark Howard.
Neither side could take a firm grip on midfield and St Mirren competed for everything in that area and denied Rangers space in which to work.
Thomson had another shooting opportunity eight minutes from half-time, but Howard managed to touch the ball over for a corner kick.
Wyness provided a warning late in the first half for Rangers but his long-range shot was always going too high.
Madjid Bougherra wasted a good chance for Rangers after 48 minutes when he had a clean header from just six yards from a Charlie Adam corner, but could not direct it on target.
Kirk Broadfoot then sent a shot wildly over the top with his left foot as Rangers stepped up the pace.
Rangers lost Thomson through injury 13 minutes into the second half and Kyle Lafferty took his place.
Steven Davis and Mendes then combined to set up Jean-Claude Darcheville but the Frenchman sent his shot wide.
Rangers had plenty of shots on goal, but more often than not their efforts were wayward and Howard was never seriously tested.
Substitute Kris Boyd finally had a header on target but there was little power and Howard gathered easily.
But McGinn stunned Rangers five minutes after coming on when he raced on to a header from Billy Mehmet to crack an unstoppable shot high past McGregor.
It left Rangers with little time to recover, but Boyd sent a header against the post in the closing minutes and Lafferty saw an effort hooked off the line by Steven Robb.