John Baird's goal four minutes from the end of extra time won Raith Rovers the Ramsdens Cup at the expense of Rangers.
Bilel Mohsni headed over from close range either side of half-time, while Nicky Law hit a post in the first period of extra time.
Despite those chances, Rovers always looked dangerous and had opportunities of their own to clinch the trophy inside the 90 minutes.
The game looked destined for penalties, though, until Baird pounced at the end.
The Easter Road triumph now goes alongside the Scottish League Cup in the Kirkcaldy club's roll of honour, with the trophy arriving 20 years after they humbled Celtic on penalties in that final at Ibrox.
For Ally McCoist's men, it is a severe blow to their confidence ahead of Saturday's Scottish Cup semi-final with Dundee United.
The first 20 minutes were going to be pivotal for Rovers and unsurprisingly they found themselves under intense pressure in front of the 19,983 crowd.
Richard Foster and Lee McCulloch threatened before Ian Black capitalised on Dougie Hill's unconvincing clearing header to fire towards goal. Lee Robinson was able to tip it over but there was no let-up from the hungry Ibrox men.
Mohsni nipped in behind his marker and should have done better with his close-range header after meeting Steven Smith's free-kick.
But Rovers weathered the early storm and, though they hardly threatened at the other end, they began to look comfortable as Rangers' early fluency waned.
Black's woeful pass to Smith on the edge of the box followed by Law's weak chip at goal a minute later summed up the Glasgow giants' fading performance.
Smith did have two good chances before half-time, Paul Watson blocking one goalbound effort, before the left-back's curled free-kick was nudged past by Robinson.
Both sides needed to find something different in a second half that started at a frantic pace.
Lee Wallace attempted to tee up Smith but played a poor ball and, although Fraser Aird kept the move alive, Robinson blocked Wallace's eventual attempt.
Rovers responded. Baird drove through the middle before unleashing their first real effort on goal - a long-range drive over the bar - before Cardle set up openings for Callum Booth and Calum Elliot. Both were errant in their finishing but Rangers were coming under increasing pressure.
Elliot was next to trouble goalkeeper Cammy Bell, the former Hearts man nipping in behind when Foster slipped but curling his shot around a post.
The Kirkcaldy men were now the team on top, and they might have had a penalty when Elliot and McCulloch battled inside the box. The ball hit the hand of the Rangers captain, but referee Kevin Clancy ignored Rovers' protests.
And the officials denied the Championship side again when Cardle was adjudged to be offside when he converted from close range after Fraser Mullen's free-kick was not cleared.
As a result of Rovers's pressure, goalkeeper Lee Robinson was a virtual spectator in the second-half and it took until seven minutes from full time before Law managed to test him with a low snap-shot.
Two minutes later, Rangers threatened again. For the second time in the game, Mohsni found himself with a free header in front of goal but put it over the bar with the goal gaping.
Rangers pushed for a winner, but they almost paid the price when Rovers bounded forward on the counter attack. Baird picked out Grant Anderson on the right and his dangerous low ball was heading to an unmarked Cardle at the back post, only for Aird to divert it wide for a corner.
Into extra-time it went. The game was there to be won with a moment of inspiration and out of nowhere Law cracked an effort against a post.
Clear chances were scarce, though, and the game appeared destined for penalties until Baird won it for Rovers at the death.
It stemmed from a series of errors by the Rangers defence. First Mohsni slipped, then McCulloch rattled an attempted clearance against Foster. He was then outmuscled by Greig Spence, who drove a shot at Bell.
The goalkeeper managed to block, but the ball fell for Baird to roll into the net, sparking wild celebrations amongst the 4,000 Raith Rovers supporters behind the goal.
Rangers's only response was a Law free-kick that sailed over the bar, meaning Rovers were able to see the game and collect the trophy.
Raith: Robinson, Thomson, Paul Watson, Hill, Booth, Anderson, Moon (Mullen 78), Fox, Cardle (Spence 90), Baird, Elliot (Smith 86). Subs Not Used: Donaldson, Laidlaw.
Booked: Fox, Elliot, Cardle, Anderson, Mullen.
Goals: Baird 117.
Rangers: Bell, Foster, McCulloch, Mohsni, Wallace (Faure 67), Aird, Black, Hutton (Clark 61), Steven Smith (Callum Gallagher 111), Daly, Law. Subs Not Used: Simonsen, Shiels.
Booked: Clark, Faure, Black, Steven Smith.
Referee: Kevin Clancy
- 8MoonSubstituted forMullenat 78'minutesBooked at 120mins
- 11AndersonBooked at 77mins
- 6FoxBooked at 42mins
- 10ElliotBooked at 45minsSubstituted forSmithat 86'minutes
- 7CardleBooked at 68minsSubstituted forSpenceat 90+5'minutes
- 5WallaceSubstituted forFaureat 66'minutesBooked at 74mins
- 8BlackBooked at 75mins
- 10HuttonSubstituted forClarkat 61'minutesBooked at 65mins
- 7SmithBooked at 79minsSubstituted forGallagherat 111'minutes
- Kevin Clancy
- Shots on Target