Rangers made a shock exit in the Ramsdens Cup after a penalty shoot-out defeat by Queen of the South at Ibrox.
Nicky Clark headed the Second Division side into the lead shortly after the break, only for Barrie McKay to level.
Rangers had Kevin Kyle sent off, but Lee McCulloch put the Division Three outfit ahead from the penalty spot.
Queens' Willie Gibson was shown a red card, but Gavin Reilly levelled and, after extra time, Ryan McGuffie scored the decisive penalty.
Rangers, the Scottish champions from two seasons ago who find themselves in the bottom tier and out of the Scottish Premier League following financial problems, had targeted cup competitions as potential money-spinners this season.
But it is the Dumfries men who will join fellow Second Division side Arbroath, First Division leaders Partick Thistle and another second-tier outfit, Cowdenbeath, in the semi-final draw in the competition for clubs outside the top flight.
Allan Johnston's side gave an early indication of the form that has taken them to the top of Division Two - and led to him being named manager of the month - as long-range efforts from Chris Mitchell and Daniel Carmichael forced fine finger-tip saves from Scotland squad goalkeeper Neil Alexander.
Following what was a fairly dour first half, the game came to life three minutes after the break when Clark rose between two static Rangers defenders to head down and under Alexander's body.
The lead only lasted six minutes as McCulloch forced an Ian Black corner into the path of McKay, who bundled the ball past former Rangers goalkeeper Lee Robertson from six yards.
Rangers had replaced Francisco Sandaza with Kyle at that set-piece and the big former Hearts striker made an instant impact, flashing a diving header just over the crossbar -then being sent off after 66 minutes for an elbow in McGuffie's face.
The home side took control despite being down to 10 men and, when Chris Higgins tripped McCulloch as the midfielder raced on to a low Lewis Macleod pass, the Rangers captain sent Robinson the wrong way from the spot.
Queens responded, but it looked like their chance had gone when a Mark Durnan header crashed off the outside of a post in stoppage time then Gibson was sent off for picking up a second yellow card.
However, Reilly slid in at the back post to level the game and, despite suspicions of offside, forced the game into overtime.
Rangers' Kal Naismith had a header cleared off the line and Dean Shiels fired into the side-netting, while Queens' Dan Orsi was denied by the feet of Alexander, but there was to be no further scoring.
When Derek Lyle sent his spot kick against the bar, it looked like Rangers' blushes would be saved, but Robinson saved from Shiels then Anestis Argyriou fired against the post to give McGuffie his moment of glory.
Rangers fans are already unhappy at the inability of a team containing international players to win away from home against the comparative minnows in Division Three and this knock-out defeat against a side from Scotland's third tier will only heap further pressure on manager Ally McCoist.
Rangers manager Ally McCoist: "It's a sore one, that's for sure, and we're really disappointed.
"To lose in the manner we did on penalties was disappointing and I don't think there was a lot between the teams.
"We are obviously disappointed in the way we lost the second goal.
"Having seen it again, a couple of the boys were telling me it was our throw-in and then then the lad looked a yard offside, but that aside we should still be defending it better.
"It's not a wake-up call for me, it's just a massive disappointment.
"We were all aware how difficult the game would be tonight against a good Queen of the South side that are doing well in the league and they also knocked Hibs out of the League Cup."
Queen of the South defender Ryan McGuffie: "I'm ecstatic. It was a great game to watch and a great game to be involved in.
"I always like to take the last penalty and I was just delighted to score."
Rangers: Alexander, Argyriou, Perry, Emilson Cribari, Wallace, McKay (Faure 79), McCulloch, Black, Macleod (Naismith 79), Shiels, Sandaza (Kyle 54). Subs Not Used: Gallacher, Aird.
Sent Off: Kyle (66). Booked: Kyle, Faure, Alexander.
Goals: McKay 55, McCulloch 72 pen.
Queen of the South: Robinson, McGuffie, Higgins, Durnan, Holt, Mitchell (Lyle 84), Derek Young, Carmichael (Orsi 97), Reilly, Gibson, Clark. Subs Not Used: Atkinson, Black, Johnston.
Sent Off: Gibson (90). Booked: Gibson, Higgins, Holt, Derek Young, McGuffie.
Goals: Clark 49, Reilly 90.
Ref: Stevie O'Reilly