Ferguson scored Birmingham's second at Goodison Park
Birmingham stretched their club-record unbeaten run to 15 games to leave Everton's dreams of a second successive FA Cup final appearance in tatters.
Birmingham took an early lead when Christian Benitez headed home Keith Fahey's cross from close range.
Barry Ferguson stretched the visitors' lead just before the break, capping a flowing move with a clinical finish.
Everton hit back with a curling strike from substitute Leon Osman, but Birmingham held firm to clinch victory.
The Blues' first victory over Everton on Merseyside since 1957 showcased all the qualities that have made them such a formidable force since last summer's return to the top-flight.
Having scored two well-constructed goals in the first half, Birmingham - who were once again superbly marshalled at the back by Scott Dann and Roger Johnson - weathered all that Everton could throw at them in the second.
If there was a shade of good fortune about the Toffees' laboured late win over League One Carlisle in the previous round, this time round their performance was too disjointed to merit victory.
It will be a disappointment felt keenly on the blue half of Merseyside.
The early months of Everton's season were blighted by indifferent form and a prolonged injury crisis, but they have rallied well of late and began the afternoon unbeaten in domestic competition since late November.
The growing sense that better times lie ahead was further fuelled when Spanish playmaker Mikel Arteta, who has been out since last February with a ruptured cruciate ligament, was named on the bench.
That news drew hearty cheers from the home support, but by the interval the cheers had turned to jeers.
Sloppy and ineffective in possession, of which they had plenty, Everton were out-thought and outfought by Alex McLeish's men, who worked tirelessly to stifle the Merseysiders down the flanks and took a deserved 7th-minute lead.
Leighton Baines failed to deal with Fahey's right-wing centre, and Ecuador international Benitez nodded past Tim Howard for his third goal of the season.
Everton fell further behind five minutes before the break when Ferguson stepped over a Sebastian Larsson cross before curling in a return pass from James McFadden.
But the half-time introduction of Osman, who replaced the ineffective Diniyar Bilyaletdinov, revitalised Everton, and within 11 minutes of the restart they finally had a long-awaited foothold in the game.
Steven Pienaar fed a Leighton Baines cross through to Osman, who curled home a wonderful goal from the edge of the box.
It was the cue for a sustained assault on the Birmingham goal, with no one in a blue shirt more prominent than Marouane Fellaini, who spurned a golden opportunity to level five minutes from time when he shot straight at Joe Hart.
The Belgian was again culpable in injury time when he screwed narrowly wide.
But on an afternoon when Birmingham demonstrated once again that they have become a potent force under McLeish, not even the introduction of Arteta for the final quarter of an hour could salvage Everton's hopes of another famous Cup run.
Everton manager David Moyes: "We left ourselves a lot to do after being two down at the break. We were so poor, it was always going to be an uphill task.
"It needed a very good performance after that to turn it around. We did well, but it was not good enough.
"We must give Birmingham credit. They played well, scored two goals and deserved to go through. We went missing from the start and never really deserved any luck after that."
Birmingham manager Alex McLeish: "It was a marvellous first half, we scored two classy goals and Barry Ferguson's will be a rival for goal of the season.
"The intricate passing, the driving run, the expert finish, it was a wonderful goal.
"Benitez's goal was good, but Ferguson's was stunning. We stood up to them, particularly in the second half when we were facing an onslaught."
90:00+4:03 The referee brings the game to a close.
90:00+2:44 Free kick awarded for a foul by Keith Fahey on Steven Pienaar. Shot on goal comes in from Mikel Arteta from the free kick,
blocked by Roger Johnson.
90:00+2:18 Johnny Heitinga fouled by Jake Jervis, the ref awards a free kick. Free kick taken by Phil Neville.
90:00+1:40 Shot by Marouane Fellaini from deep inside the penalty area misses to the right of the target.
88:54 Substitution James McFadden leaves the field to be replaced by Gary McSheffrey.
86:30 Shot from outside the area by Mikel Arteta misses to the left of the goal.
85:00 Inswinging corner taken from the right by-line by Mikel Arteta, Johnny Heitinga produces a header from inside the area that
goes over the crossbar.
84:41 Marouane Fellaini takes a shot. Fantastic save by Joe Hart.
82:26 Booking Booking for Leon Osman for unsporting behaviour.
82:18 Foul by Leon Osman on James McFadden, free kick awarded. Free kick taken by Barry Ferguson.
79:36 James McFadden has a direct shot on goal from the free kick.
79:36 Booking Tim Cahill goes into the referee's book for unsporting behaviour.
79:28 Unfair challenge on Lee Bowyer by Tim Cahill results in a free kick.
78:35 Substitution Jake Jervis joins the action as a substitute, replacing Christian Benitez.
78:25 Effort on goal by James Vaughan from inside the penalty area goes harmlessly over the bar.
75:20 Substitution Mikel Arteta is brought on as a substitute for Landon Donovan.
75:20 James Vaughan concedes a free kick for a foul on Roger Johnson. Joe Hart takes the direct free kick.
74:38 Leighton Baines concedes a free kick for a foul on Sebastian Larsson. Direct free kick taken by Joe Hart.
74:05 Outswinging corner taken right-footed by Landon Donovan from the right by-line, Lee Bowyer makes a clearance.
73:35 Christian Benitez produces a left-footed shot from outside the box and misses left.
73:18 James Vaughan challenges Roger Johnson unfairly and gives away a free kick. Barry Ferguson takes the free kick.
72:39 Phil Neville challenges Barry Ferguson unfairly and gives away a free kick. Joe Hart restarts play with the free kick.
71:24 James Vaughan has a headed effort from close range and clears the crossbar.
70:55 Corner taken right-footed by Landon Donovan, clearance by Roger Johnson.
70:45 Steven Pienaar takes a shot. Blocked by Liam Ridgewell.
69:48 Foul by Lee Bowyer on Steven Pienaar, free kick awarded. Steven Pienaar restarts play with the free kick.
68:20 Substitution (Everton) makes a substitution, with James Vaughan coming on for Louis Saha.
68:20 Free kick awarded for a foul by James McFadden on Phil Neville. Johnny Heitinga restarts play with the free kick.
66:47 Free kick awarded for an unfair challenge on Christian Benitez by Leighton Baines. James McFadden crosses the ball from the
free kick right-footed from right wing, clearance made by Landon Donovan.
65:40 Unfair challenge on Phil Neville by James McFadden results in a free kick. Johnny Heitinga restarts play with the free kick.
Correction - 63:30 Louis Saha produces a left-footed shot from just outside the box that goes wide right of the target.
63:30 Louis Saha has shot on goal from just outside the box which goes wide of the right-hand upright.
61:49 Unfair challenge on Lee Bowyer by Tim Cahill results in a free kick. Stephen Carr takes the free kick.
60:35 The referee blows for offside. Tim Howard takes the free kick.
60:08 Effort on goal by Louis Saha from just inside the area clears the crossbar.
58:54 Foul by Barry Ferguson on Leon Osman, free kick awarded. Free kick crossed left-footed by Leighton Baines.
55:29 Assist by Steven Pienaar.
55:29 GOAL - Leon Osman:Everton 1 - 2 Birmingham Goal scored by Leon Osman from just outside the area to the bottom right corner of the goal. Everton 1-2 Birmingham.
51:27 Free kick awarded for a foul by Christian Benitez on Johnny Heitinga. Free kick taken by Johnny Heitinga.
50:44 Header on goal by Marouane Fellaini from inside the box goes harmlessly over the target.
50:05 Foul by Lee Bowyer on Steven Pienaar, free kick awarded. Marouane Fellaini restarts play with the free kick.
49:47 Christian Benitez takes a shot. Save made by Tim Howard.
48:12 Marouane Fellaini concedes a free kick for a foul on Sebastian Larsson. Barry Ferguson takes the direct free kick.
46:54 Shot from just outside the box by Leon Osman goes over the target.
46:09 Leighton Baines fouled by Barry Ferguson, the ref awards a free kick. Sylvain Distin restarts play with the free kick.
45:28 Shot from long distance by Sebastian Larsson goes wide of the left-hand post.
45:01 The game restarts for the second half.
45:01 Substitution (Everton) makes a substitution, with Leon Osman coming on for Diniyar Bilyaletdinov.
45:00+1:10 The referee calls an end to the first half.
45:00+0:50 Liam Ridgewell challenges Landon Donovan unfairly and gives away a free kick. Phil Neville takes the direct free kick.
41:02 Free kick awarded for an unfair challenge on James McFadden by Diniyar Bilyaletdinov. Direct free kick taken by Joe Hart.
39:35 Assist by James McFadden.
39:35 GOAL - Barry Ferguson:Everton 0 - 2 Birmingham Barry Ferguson fires in a goal from deep inside the penalty box to the bottom left corner of the goal. Everton 0-2 Birmingham.
38:39 Foul by Tim Cahill on Roger Johnson, free kick awarded. Direct free kick taken by Roger Johnson.
38:00 Corner taken left-footed by James McFadden from the right by-line to the near post, Roger Johnson produces a header from deep
inside the six-yard box which goes wide of the right-hand upright.
37:13 Steven Pienaar has an effort at goal from just outside the penalty box which goes wide of the left-hand post.
35:56 Louis Saha gives away a free kick for an unfair challenge on Stephen Carr. Joe Hart takes the direct free kick.
35:01 The referee penalises Tim Cahill for handball. Joe Hart takes the direct free kick.
33:43 Tim Cahill is ruled offside. Joe Hart takes the direct free kick.
32:19 Inswinging corner taken left-footed by James McFadden from the right by-line to the near post, save made by Tim Howard.
30:07 Foul by Diniyar Bilyaletdinov on Roger Johnson, free kick awarded. Joe Hart restarts play with the free kick.
28:17 Marouane Fellaini gives away a free kick for an unfair challenge on Christian Benitez. Free kick taken by Scott Dann.
23:53 Foul by James McFadden on Diniyar Bilyaletdinov, free kick awarded. Leighton Baines takes the direct free kick.
19:39 Shot by Marouane Fellaini from outside the box goes high over the target.
18:45 Christian Benitez is ruled offside. Indirect free kick taken by Tim Howard.
17:04 Roger Johnson fouled by Tim Cahill, the ref awards a free kick. Direct free kick taken by Stephen Carr.
12:42 Louis Saha takes a shot. Blocked by Lee Bowyer.
11:23 Free kick awarded for an unfair challenge on Tim Cahill by Stephen Carr. Steven Pienaar takes the direct free kick.
9:33 Free kick awarded for a foul by Liam Ridgewell on Landon Donovan. Free kick crossed left-footed by Leighton Baines, Stephen
Carr manages to make a clearance.
6:16 Assist on the goal came from Keith Fahey.
6:16 GOAL - Christian Benitez:Everton 0 - 1 Birmingham Christian Benitez scores a headed goal from inside the six-yard box. Everton 0-1 Birmingham.
5:09 Scott Dann gives away a free kick for an unfair challenge on Tim Cahill. The free kick is swung in left-footed by Leighton
Baines, Scott Dann makes a clearance.
3:04 The official flags Christian Benitez offside. Johnny Heitinga takes the free kick.
0:00 The referee gets the game underway.
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.