Huddersfield scored three goals in extra time to overcome Birmingham 4-1 in their FA Cup fourth-round replay at St Andrew's on Tuesday evening.
Che Adams, on a rare start, raised home hopes by putting the Blues ahead seven minutes into the second half, only for Marc Roberts' own goal to level things up on the hour mark.
And the Terriers, who were often frustrated by Birmingham goalkeeper David Stockdale, edged ahead with two quickfire goals early in extra time through Steve Mounie and substitute Rajiv van La Parra before Tom Ince sealed matters with a fourth goal in the 106th minute.
The result earned David Wagner's side a fifth-round tie at home to Manchester United.
Huddersfield dictated for periods but were unable to make a first-half breakthrough.
Scott Malone, one of five changes made from the side beaten by Manchester United at the weekend, fired in a powerful 30-yard low drive which Stockdale saved.
This incident set the pattern for the early exchanges with Birmingham, who showed seven changes from the side which convincingly won at Sheffield Wednesday, struggling to get to grips with the tie.
The Blues had another let-off when Stockdale made a poor clearance straight to Abdelhamid Sabiri who, to the relief of the home keeper, shot into the side-netting.
Birmingham, unbeaten in their previous four games, struggled to put together any promising attacking moves, while the potential danger of Adams was effectively shackled by Mathias Jorgensen.
The home defence looked all at sea and should have been punished late in the first period when Malone wasted a fine opportunity to open the scoring only to carelessly lash his left-footed attempt into the side-netting.
It proved an expensive miss as Birmingham took the lead in the 53rd minute.
Lukas Jutkiewicz beat Jorgensen to a high ball and headed down for Adams to fire a low shot on the turn past Jonas Lossl.
The goal immediately sparked some concentrated attacking play from the visitors, with Ince taking the credit for putting them back on level terms in the 60th minute.
Ince produced a rocket-like shot from 25 yards which Stockdale could only parry. It looped over his head and Roberts turned the ball into his own net.
Both teams ramped up the pressure but the winning goal eluded them in normal time and the extra 30 minutes were required, despite Huddersfield bombarding the Birmingham goal and forcing Stockdale into a series of quality saves.
Mounie put Town ahead four minutes into extra time, heading home from close range following a left-wing cross from Van La Parra.
Van La Parra notched another easy goal three minutes later, after Stockdale had pushed a shot into his path, and Ince rounded off the rout with a fourth goal in the 106th minute.