Connor Goldson swept Rangers into an early lead but a late penalty in the first-half gave St Mirren a lifeline after a dominant display from the visitors.
The home side went ahead with Jamie McGrath’s second of the night shortly after the break and looked to be seeing out a memorable win before Steven Davis struck the equaliser after James Tavernier’s free-kick hit the post.
But there would be no extra-time as St Mirren rallied again and scored from close range in injury time to deny Steven Gerrard’s team a place in the semi-final.
Here’s how the players rated during the first defeat of the season for Rangers.
Scale - 10: One of the best performances you've seen. 9: Outstanding. 8: Very good. 7: Good. 6: Average. 5: Poor, 4: Very poor. 3: A terrible day at the office. 2: Abysmal. 1: One of the worst performances you've seen

. GLASGOW, SCOTLAND - OCTOBER 17: Rangers manager Steven Gerrard during a Scottish Premiership match between Celtic and Rangers at Celtic Park, on October 17, 2020, in Glasgow, Scotland. (Photo by Craig Williamson / SNS Group)
Steven Gerrard is eyeing a Hampden date next month in the Betfred Cup semi-final - but St Mirren stand in his way (Craig Williamson - SNS Group) Photo: Craig Williamson - SNS Group

. Allan McGregor - 7
Little to do in the first half but kept Rangers in touch in the second with a great stop to deny Joe Shaughnessy's header on 73 minutes then two stops in lead up to Saints' winner. Photo: Craig Williamson - SNS Group

. James Tavernier - 6
Captain is human after all - following some stunning performances, this was a bit of a quieter showing. Denied another goal by linesman's flag in second half and inches away with the free-kick leading to Davis' equaliser. Photo: Alan Harvey - SNS Group

1. Allan McGregor - 7
Little to do in the first half but kept Rangers in touch in the second with a great stop to deny Joe Shaughnessy's header on 73 minutes then two stops in lead up to Saints' winner. Photo: Craig Williamson - SNS Group

2. James Tavernier - 6
Captain is human after all - following some stunning performances, this was a bit of a quieter showing. Denied another goal by linesman's flag in second half and inches away with the free-kick leading to Davis' equaliser. Photo: Alan Harvey - SNS Group

3. Connor Goldson - 8
A quite stunning first half with driving runs from the back and a great goal. Kept Obika quiet but won't be happy at the second Saints goal Photo: Craig Williamson - SNS Group

4. Leon Balogun - 6
Exposed for the Saints second goal and eclipsed in the first half by his defensive partner. Hefty head knock led to his substitution with seven minutes left. Photo: Craig Foy - SNS Group