David Hopkin's brave Bantams were cruelly denied a place in the third round of the Emirates FA Cup after losing out on penalties to Peterborough United following a memorable and action-packed replay at the Northern Commercials Stadium.
Peterborough 'keeper Connor O'Malley saved penalties from Karl Henry, Jack Payne and Paul Caddis in the shoot-out to secure a 3-2 success for The Posh - but that doesn't begin to tell half of the drama of the night.
In one of the most entertaining and enthralling cup ties at Valley Parade for many a year, Hopkin's men fought back from 2-0 and 3-1 down to amazingly lead 4-3 in the closing stages thanks to goals from George Miller (2), David Ball and Caddis.
Ivan Toney netted for Peterborough in the 84th minute, however, to incredibly make the score 4-4; the striker claiming his hat-trick in the process.
City skipper Anthony O'Connor crashed an effort against the bar in injury time, but the game eventually went to spot-kicks and Peterborough were the side who ran out successful to claim a trip to Championship side Middlesbrough in the next round.
Despite the penalty defeat, though, the Bantams should feel extremely positive about their efforts against a promotion-chasing and high-scoring Peterborough side.
City registered 35 attempts towards goal on the night, with 13 of those efforts being on target, and claimed 12 corners.
The Bantams probably deserved to edge it over ninety minutes, but the performances of Peterborough's two stand-out and in-form attackers - Marcus Maddison and Toney - were perhaps the difference on the night for The Posh.
Maddison set two goals up and scored Peterborough's third, while Toney's treble made it nine goals in eight games for the striker.
Following Saturday's eye-catching 3-3 draw at Plymouth Argyle, Hopkin made three changes to his starting XI for City's third match with Peterborough in less than a month.
Ben Wilson was handed his home debut in goal, with Nathaniel Knight-Percival - back from suspension - and Hope Akpan given recalls.
As a result of the changes, Richard O'Donnell, Eoin Doyle and Henry all began the tie from the bench.
The Bantams started the match with real purpose, and they could have took an early lead when Miller latched onto a loose clearance from Rhys Bennett in the box.
Miller fired for goal first time with a snap-shot, but his effort on the half-volley flew just past the post.
Peterborough responded soon after - Toney moving into shooting space after skipping past O'Connor - but his shot for goal in the box was pushed behind by Wilson.
City continued their positive start to the game - Ball forcing a low save from O'Malley with a drive from outside the box - but it was the visitors who soon moved into the lead with a moment of brilliance.
After Peterborough won a free-kick just inside City's half of the pitch, Toney took the set-piece on early and lofted a superb effort from some distance out over Wilson's head and into the net.
To make matters worse, Peterborough then stunned the home crowd by doubling their advantage less than two minutes later.
Again, it was Toney doing the damage. The former Newcastle forward stooping to head in from close range following Maddison's inviting ball into the box from the left.
Credit to City, however, they fought straight back.
A loose piece of handling from O'Malley saw the ball drop at the feet of Ball inside the box.
The attacker's strike for goal was deflected onto the post by the out-stretched boot of Colin Daniel, but Miller was on hand to fire in from only a couple of yards out.
Incredibly, Ball could have dragged City level soon after. He turned away from Mark O'Hara in the box, but his curling left-footed effort from deep inside the box flew over.
Boosted by Miller's reply, City continued to test their visitors. Miller himself, Payne and Ball all had further efforts for goal later in the half.
Peterborough did have the ball in the net on the half hour mark but Toney was flagged offside after converting from a Maddison cross.
Maddison himself fired over with an effort from just inside the box shortly afterwards, with Lewis O'Brien then warming the hands of O'Malley with a drive from the edge of the box at the other end a few minutes later.
As City continued to show plenty of endeavour against their talented opponents, Payne then fired narrowly wide of the far post with an effort fom just outside the box four minutes from the break.
The game looked to be heading to the interval with Peterborough having their noses slightly in front, but the visitors were actually able to increase their advantage right on the stroke of half time.
Siriki Dembele's cross into the six yard box was flicked goalwards by Jason Cummings.
Wilson produced a great reflex save to repel the effort but Maddison was on hand to tap in the loose ball.
That goal seemingly left City with a mountain to climb at their interval, but they responded to the challenge in breathtaking fashion.
Miller fired a Kelvin Mellor cross into the hands of O'Malley just a few minutes after the interval, as City gave Peterborough an early signal of their intent for the half.
Only seven minutes after the break the Bantams had a goal back.
A deflected Lewis O'Brien strike eventually dropped into the path of Ball via Payne and the striker fired low past O'Malley.
City then turned the game on its head less than five minutes later when Ball turned provider.
Ball's clipped cross towards the far post from inside the box found Caddis in space and the unmarked full back headed home from close range.
After looking out of it at the break - despite performing so admirably in the first period - City had clawed their way level to make the scores 3-3.
In truth, it was no more than Hopkin's side deserved as well given the tempo and commitment of their play.
Trying to rally from the shock of being pegged back, Peterborough made a double attacking change, but it was City who were still looking the more likely scorers.
Lewis O'Brien saw a shot from just outside the box tipped around the post by O'Malley.
Payne's delivery into the box from the resulting set-piece eventually came back to him via Mellor, but City's number ten fired narrowly over.
Maddison had a fierce drive from distance held by Wilson soon after, but it was another Payne corner seventeen minutes from the end of normal time that amazingly fired the Bantams in front.
Payne's delivery to the far post was headed down by O'Connor into the mix and Miller poked home from only a couple of yards out.
With an entertaining encounter showing no signs of slowing down, Peterborough nearly came back shortly afterwards but a curling effort towards the far post from Maddison was narrowly missed by a stretching Toney.
Peterborough sub Matt Godden then headed over soon after from a decent position in the box following Toney's cross from the byline.
Sadly for City, Toney himself showed his team-mate how it was done six minutes from the end of normal time to claim the match-ball.
Maddison's cross into the box found an unmarked Toney and the in-form striker, who has netted in all three recent matches between the two sides, planted a free header into the far corner.
Sensationally, City could have actually still won the tie in injury time at the end of ninety minutes.
A far post corner delivery from Payne was met by O'Connor and the Irishman crashed a volley firmly against O'Malley's bar.
After a captivating contest in normal time, City and Peterborough took the replay into a further thirty minutes.
In a fairly low-key first period of extra time, second half sub Doyle fired low at O'Malley from the edge of the box, while Godden hit the bar for Peterborough at the other end but the forward was flagged offside.
City started the second half with a fizzing drive from the edge of the box narrowly over by Adam Chicksen.
After that, however, Peterborough had some bright openings to win it ahead of penalties.
Maddison played Joe Ward into clear shooting space inside the box, but Wilson produced a superb one-on-one save to repel the Peterborough full back.
Maddison was involved again soon after when he tried to pick out Toney with a through-ball.
The pass was cut out by O'Connor, but the loose ball fell to Godden and the sub fired narrowly wide of the target.
So onto penalties, and Doyle gave City the perfect start by converting the opening spot-kick.
Maddison responded by netting his own penalty for Peterborough to level the scores.
Henry was denied by O'Malley, but Wilson kept the Bantams in it straight after by repelling Toney's penalty.
Lewis O'Brien and Godden scored for their sides from the following kicks, but a saved Payne penalty gave the visitors the advantage again.
A successful Jamie Walker penalty, despite Wilson getting a hand to it, put Peterborough on the verge of progression, with O'Malley then sealing their trip to the Riverside Stadium in early January by keeping out Caddis' effort next up.
For match line-ups, stats and updates from the Peterborough cup replay, please visit our Match Centre - HERE.