Brentford bowed out of the Carling Cup after Premier League Birmingham beat the brave League One side on penalties.
Craig Woodman had his crucial spot-kick saved by Maik Taylor after Kevin Phillips had spared Blues from defeat with a strike deep into stoppage time.
Sam Wood had given Brentford the lead with a brilliant volley and they also went close through Myles Weston.
Nikola Zigic should have scored the winner for Blues in stoppage time but his header was saved by Richard Lee.
During the 30 minutes of extra time, Brentford were hanging on as fatigue set in and a penalty shoot-out, which saw off Everton in the previous round, seemed like the visitors' only path to progression.
During the climax, Birmingham held a 3-2 lead before the Bees' Mickey Spillane missed from the spot.
But the home side's advantage was wiped away immediately when Lee Bowyer fired his effort over the bar.
After the next two penalties were scored, the pressure was on Woodman. A miss would result in defeat and unfortunately for the Tiverton-born defender he rolled his effort straight at goalkeeper Taylor.
It was the second heartbreaking moment for the Londoners, who were set for a Carling Cup quarter-final berth up until the second of four minutes of stoppage time when Liam Ridgewell teed up Phillips to finish with an effort that rolled under keeper Lee.
After a non-descript first-half that saw the Bees produce the best effort, a Weston shot pushed away by Taylor, the game sprung to life.
First, Spillane stung the palms of Taylor with an angled shot before Brentford finally made the breakthrough when Weston fed Charlie MacDonald, whose layoff was buried by former Bromley player Wood.
Birmingham pressed forward in desperation and must have thought their final chance to save their campaign came and went when Craig Gardner's powerful effort was saved by Lee.
But Phillips and then luck from the spot ensured Blues a place in the last eight.
Birmingham boss Alex McLeish: "Brentford were superb, well organised and battled. I thought we were out the cup.
"But, when you have the hunger and desire to keep going right to the end, I have to salute the players.
"We put together three or four passes together for the first time for the goal. We lacked creativity and imagination before that.
"That made it look like we wouldn't score but Kevin did what he does best, we're in the hat and that's what counts."
Brentford boss Andy Scott: "I think Brentford as a club hasn't had the recognition it deserved over the last few years.
"We have a strong club, I am a young manager, we have players we have brought out of non league.
"We've proved we have a strong club with a good fan base, good enough to bring 3,000 supporters here tonight.
"We didn't get anybody in the team of the year when we won League Two by six points and I didn't get manager of the year.
"That doesn't matter. What matters is we have a good club."
125:17 Penalty taken by Craig Woodman is saved by Maik Taylor.
125:04 Penalty scored by Stephen Carr. Birmingham 4-3 Brentford on penalties.
124:21 Lewis Grabban scores a penalty. Birmingham 3-3 Brentford on penalties.
123:46 Penalty missed by Lee Bowyer.
123:17 Spot kick missed by Michael Spillane.
122:41 Scott Dann scores a penalty. Birmingham 3-2 Brentford on penalties.
122:07 Penalty scored by David Hunt. Birmingham 2-2 Brentford on penalties.
121:34 Penalty scored by Craig Gardner. Birmingham 2-1 Brentford on penalties.
121:06 Penalty scored by Kevin O'Connor. Birmingham 1-1 Brentford on penalties.
120:03 Penalty scored by Kevin Phillips. Birmingham 1-0 Brentford on penalties.
120:01 The referee calls the first player forward to start the penalty shoot-out.
Extra Time Complete
120:00+0:21 The match is going to penalties.
117:09 Shot comes in from Lewis Grabban from the free kick, blocked by Craig Gardner. Free kick awarded for a foul by Marcus Bean
on Craig Gardner. Shot on goal comes in from Craig Gardner from the free kick.
114:54 Nathan Redmond produces a cross, Karleigh Osborne manages to make a clearance.
113:39 The ball is swung over by Stuart Parnaby, clearance by Karleigh Osborne.
112:10 A cross is delivered by Stephen Carr. Craig Gardner is penalised for a handball. Direct free kick taken by Richard Lee.
109:13 Nathan Redmond crosses the ball, Karleigh Osborne makes a clearance.
107:23 The ball is delivered by Nathan Redmond, Karleigh Osborne manages to make a clearance.
106:51 The ball is swung over by Stephen Carr, blocked by Craig Woodman.
105:43 The ball is swung over by Lee Bowyer.
Extra Time Started
105:01 The second half of extra time gets under way.
Extra Time Half Time
102:02 Lee Bowyer sends in a cross, clearance by Karleigh Osborne.
101:26 Marcus Bean produces a drilled right-footed shot from 35 yards and missed to the left of the goal.
100:37 Kevin Phillips has shot on goal from just outside the area which goes wide of the right-hand upright.
100:37 Substitution David Hunt replaces Charlie MacDonald.
99:29 Nikola Zigic takes a shot. Richard Lee makes a save.
98:15 The official flags Kevin Phillips offside. Indirect free kick taken by Richard Lee.
96:51 Centre by Lee Bowyer, clearance made by Karleigh Osborne.
96:41 The ball is sent over by Stephen Carr, Marcus Bean makes a clearance.
94:42 The ball is crossed by Michel, Leon Legge makes a clearance.
92:00 Booking Booking for Karleigh Osborne for unsporting behaviour.
91:00 Substitution Barry Ferguson replaces Michel.
Extra Time Started
90:00+4:31 The match has reached the end of normal time.
90:00+3:44 Free kick awarded for a foul by Kevin O'Connor on Nikola Zigic. Michel takes the direct free kick.
90:00+3:12 Stuart Parnaby fouled by Lewis Grabban, the ref awards a free kick. Free kick taken by Stuart Parnaby.
Correction - 90:00+2:00 Assist by Liam Ridgewell.
90:00+2:00 The assist for the goal came from Scott Dann.
90:00+2:00 GOAL - Kevin Phillips:Birmingham 1 - 1 Brentford Kevin Phillips scores a goal from close range to the bottom right corner of the goal. Birmingham 1-1 Brentford.
90:00+1:15 Karleigh Osborne challenges Nikola Zigic unfairly and gives away a free kick. Michel restarts play with the free kick.
89:27 Leon Legge fouled by Kevin Phillips, the ref awards a free kick. Free kick taken by Richard Lee.
89:27 Booking Richard Lee receives a caution for time wasting.
88:47 Lewis Grabban delivers the ball, Liam Ridgewell manages to make a clearance.
88:17 Lee Bowyer produces a cross, clearance by Karleigh Osborne.
86:44 Booking Charlie MacDonald is cautioned by the ref for unsporting behaviour.
85:45 A cross is delivered by Stephen Carr, Nikola Zigic produces a header from inside the area that goes over the crossbar.
84:52 Foul by Charlie MacDonald on Liam Ridgewell, free kick awarded. Free kick taken by Maik Taylor.
84:19 Handball decision goes against Lee Bowyer. Richard Lee takes the direct free kick.
83:12 Foul by Lee Bowyer on Lewis Grabban, free kick awarded. Craig Woodman has an effort direct from the free kick,
82:31 Substitution Myles Weston goes off and Robbie Simpson comes on.
81:08 Stephen Carr challenges Charlie MacDonald unfairly and gives away a free kick. Direct free kick taken by Richard Lee.
79:50 Nathan Redmond produces a cross, Shot by Craig Gardner. Save by Richard Lee. Lee Bowyer takes a outswinging corner to the
near post, Liam Ridgewell produces a header from inside the six-yard box that clears the bar.
77:39 Craig Woodman challenges Craig Gardner unfairly and gives away a free kick. Craig Gardner fires a strike on goal direct from
the free kick.
77:02 Free kick awarded for an unfair challenge on Nikola Zigic by Leon Legge. Michel takes the direct free kick.
76:15 Substitution Nikola Zigic replaces Matt Derbyshire.
75:54 Effort on goal by Nathan Redmond from outside the area goes harmlessly over the bar.
74:26 Substitution Gary Alexander goes off and Lewis Grabban comes on.
71:00 Kevin Phillips fouled by Marcus Bean, the ref awards a free kick. Direct free kick taken by Michel. Drilled right-footed shot
by Craig Gardner. Blocked by Karleigh Osborne. Outswinging corner taken from the left by-line by Lee Bowyer.
70:19 Handball by Craig Woodman. Stephen Carr takes the direct free kick.
67:50 Assist on the goal came from Charlie MacDonald.
67:50 GOAL - Sam Wood:Birmingham 0 - 1 Brentford Sam Wood scores a goal from deep inside the penalty area to the bottom left corner of the goal. Birmingham 0-1 Brentford.
65:39 Lee Bowyer produces a right-footed shot from deep inside the penalty box which goes wide of the left-hand post.
63:03 Substitution (Birmingham) makes a substitution, with Nathan Redmond coming on for Garry O'Connor.
61:49 Free kick awarded for an unfair challenge on Craig Gardner by Myles Weston. Stephen Carr takes the direct free kick.
60:41 Shot by Stuart Parnaby from a long way out goes over the target.
60:12 The ball is swung over by Garry O'Connor, save by Richard Lee. Corner taken short by Lee Bowyer. Lee Bowyer sends in a cross,
clearance by Karleigh Osborne.
59:17 Craig Woodman delivers the ball, clearance made by Stephen Carr. Corner taken left-footed by Myles Weston from the left by-line,
Marcus Bean takes a shot from just inside the penalty box which clears the bar.
54:20 Outswinging corner taken left-footed by Myles Weston, Shot from 18 yards from Michael Spillane. Michel makes a clearance.
54:12 The ball is swung over by Craig Woodman, clearance made by Liam Ridgewell.
52:50 Outswinging corner taken by Lee Bowyer from the right by-line. The ball is delivered by Michel, Liam Ridgewell produces a
header from inside the area that goes over the crossbar.
52:18 Myles Weston challenges Stephen Carr unfairly and gives away a free kick. Maik Taylor takes the free kick.
51:41 Shot by Craig Gardner. Save made by Richard Lee.
48:27 Foul by Gary Alexander on Michel, free kick awarded. Maik Taylor restarts play with the free kick.
47:33 Sam Wood has an effort at goal from 12 yards. Save by Maik Taylor.
45:15 The ball is delivered by Sam Wood.
45:01 The referee gets the second half underway.
45:00+1:04 The whistle is blown to end the first half.
45:00+0:20 Outswinging corner taken by Lee Bowyer from the right by-line.
45:00+0:03 Kevin Phillips delivers the ball, Karleigh Osborne makes a clearance.
42:04 The ball is sent over by Matt Derbyshire, Karleigh Osborne manages to make a clearance.
41:23 The ball is delivered by Stephen Carr, clearance by Karleigh Osborne.
39:41 The assistant referee signals for offside against Myles Weston. Maik Taylor takes the free kick.
39:03 Michael Spillane delivers the ball, Maik Taylor makes a brilliant save.
38:00 The ball is delivered by Craig Woodman.
36:44 The offside flag is raised against Kevin Phillips. Richard Lee takes the indirect free kick.
35:10 The assistant referee signals for offside against Gary Alexander. Maik Taylor takes the free kick.
32:57 Shot from 35 yards by Michel. Blocked by Leon Legge.
32:52 The ball is crossed by Lee Bowyer, clearance made by Gary Alexander.
32:08 Free kick awarded for a foul by Craig Woodman on Stephen Carr. Free kick taken by Michel.
31:42 Gary Alexander handles the ball and concedes a free kick. Liam Ridgewell takes the direct free kick.
27:48 Myles Weston takes a shot. Save by Maik Taylor. Outswinging corner taken left-footed by Myles Weston from the left by-line,
Header from deep inside the area by Karleigh Osborne goes over the bar.
25:29 Myles Weston delivers the ball.
24:53 Stuart Parnaby takes a shot. Save by Richard Lee.
23:53 Myles Weston delivers the ball.
23:14 Garry O'Connor produces a drilled left-footed shot from 20 yards. Save made by Richard Lee.
20:21 Shot by Kevin Phillips. Save by Richard Lee.
18:33 Garry O'Connor crosses the ball, clearance made by Leon Legge.
12:48 Foul by Gary Alexander on Liam Ridgewell, free kick awarded. Maik Taylor restarts play with the free kick.
12:29 Matt Derbyshire is flagged offside by the assistant referee. Free kick taken by Michael Spillane.
10:28 The assistant referee flags for offside against Gary Alexander. Indirect free kick taken by Maik Taylor.
10:14 Centre by Myles Weston, Scott Dann makes a clearance.
6:27 Shot by Lee Bowyer from a long way out goes over the crossbar.
2:24 Craig Woodman crosses the ball, blocked by Craig Gardner.
0:57 Michel has an effort at goal from just outside the box which goes wide of the left-hand post.
0:18 Stuart Parnaby delivers the ball, Michael Spillane gets a block in. Corner taken by Lee Bowyer from the left by-line played
to the near post, Leon Legge makes a clearance.
0:00 The ref blows the whistle to begin the match.
Live text and data provided by The Press Association.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.