The visitors needed just 16 runs from the last 13 balls with six wickets in hand to overhaul Yorkshire’s total of 156-6.
But Yorkshire took those six wickets for just 13 runs to pull off a win for which the term “snatched victory from the jaws of defeat” was invented.
It left them two points off fourth place in the North Group when defeat would have sent them bottom of the table and all-but ended their interest in the tournament.
The collapse started when Will Porterfield skied Tim Bresnan to wicketkeeper Andrew Hodd after top-scoring for the visitors with 48 from 41 balls.
David Willey then ran-out Rikki Clarke backing-up before having Jeetan Patel caught at deep mid-wicket for a golden duck.
And with 11 needed from Bresnan’s last over, Recordo Gordon slapped the first ball back to Bresnan before Josh Poysden and Ateeq Javid were run-out, the latter striking the final delivery to long-on where superb fielding from Adam Lyth prevented a boundary that would have tied the match, Javid run-out going for a third run.
It was breathless stuff, watched by a crowd of 7,082, and a terrific win by a Yorkshire side that can never have had to dig deeper to win a T20 game.
In sunny conditions, Lyth had given Yorkshire a flying start to the match.
The left-hander drove the third ball from Rikki Clarke to the cover boundary in front of the West Stand and launched the next delivery into the upper tier of the North East Stand.
But Lyth fell to the 10th ball of the contest when he miscued former Yorkshire pace bowler Oliver Hannon-Dalby to cover, and Yorkshire slipped to 34-2 from the last delivery of the fifth over when Willey, aiming to leg, sliced Hannon-Dalby to point.
Yorkshire managed five boundaries in the powerplay in reaching 39-2 from six overs, two of them scored by Alex Lees, who off-drove Hannon-Dalby beautifully and pulled Gordon powerfully.
The Yorkshire captain then took successive fours off leg-spinner Josh Poysden before fatally giving him the charge as Yorkshire slipped to 53-3.
A period of consolidation followed as Kane Williamson and Gary Ballance traded singles before Williamson branched out with a six over mid-wicket off Poysden.
Ballance struck successive fours off Hannon-Dalby before he was fourth out at 131 in the 18th over, bowled trying to hit Clarke to leg to end a stand of 78 with Williamson in 9.5 overs.
Bresnan hammered his first ball for six over mid-wicket before holing out to long-off in the final over. Williamson also fell in the final over in trying to steal a bye, run-out by wicketkeeper Matthew Wade for 48, his highest T20 score for Yorkshire.
Jack Leaning also hammered his first ball for six, propelling Gordon over long-on, as the hosts got themselves up to a competitive score.
Willey opened the Birmingham reply with a wide but struck with the first legitimate ball when Sam Hain was lbw padding up.
Willey might have had another wicket in his next over but Ian Bell was dropped on 13 at cover by a diving Lyth, who made a valiant effort, and Bell and Porterfield took Birmingham to 48-1 at the end of the powerplay.
But Bell then played a nothing shot to leg-spinner Adil Rashid’s fifth delivery and was stumped for 30, leaving Birmingham 52-2.
Rashid struck again when Wade spooned tamely to backward-point, and Rashid and fellow spinner Azeem Rafiq pegged it back well in a game in which pace off the ball was a productive avenue.
At halfway, Birmingham were 65-3 - Yorkshire had been 64-3 - and it remained nip-and-tuck.
Porterfield and Laurie Evans added 60 for the fourth wicket in seven overs, Evans playing well for 37 from 28 before skying a Rafiq full toss to deep mid-wicket.
Bresnan delivered a hat-trick of wides in the 18th over before his removal of Porterfield to the final ball proved a turning point.
How Birmingham contrived to lose the match was anyone’s guess; how Yorkshire managed to win it was equally mystifying.
Josh Shaw, the 20-year-old pace bowler, has returned to Gloucestershire on loan.
Shaw had been recalled to help Yorkshire through a personnel crisis caused by injuries/international calls.
Yorkshire return to T20 action tomorrow when they take on Derbyshire at Derby (2.30pm start).