Paul Quinn sent Cardiff into the Carling Cup fourth round as Leicester were edged out in a penalty shoot-out.
A goalless extra time was followed by 12 successful kicks, but then Gelson Fernandes ballooned over the bar.
In normal time Don Cowie had headed Cardiff in front, only for Steve Howard to slide home a near-post equaliser.
A rebound fell kindly for Lloyd Dyer to give Leicester the lead, but Rudy Gestede sent the game into extra time with a brilliant 25-yard shot.
The penalty shoot-out defeat was especially hard on Leicester, as it brought back painful memories of the 2009/10 season's play-off semi-final loss to the same opponents in the same manner.
But the League Cup clash was the first of two meetings between the teams this week, and Leicester will have their chance of revenge when they return to the Cardiff City Stadium on Sunday for their Championship encounter.
Leicester had the first sight of goal but Jeff Schlupp wasted the chance, heading over the Cardiff crossbar from eight yards out after connecting with Franck Moussa's cross.
At the other end Rob Earnshaw was looking lively and settled himself to lurk on the shoulder of the last defender, although the Cardiff striker's over-eagerness saw him fall foul of the offside flag too often.
Stephen McPhail had started for Cardiff, making a welcome return after cancer treatment, but the midfielder lasted just 29 minutes before picking up an injury and was replaced by Aron Gunnarsson to a standing ovation.
Cardiff settled down after that early interruption and Chris Weale was called into action when Earnshaw's strike partner Gestede clipped in a shot after being played through by Filip Kiss.
But the Leicester goalkeeper was helpless to prevent Cowie from breaking the deadlock soon after.
Left-back Andrew Taylor was allowed to advance unmolested and whipped in a fine cross that found Cowie, who flicked his header into the far corner.
Leicester pressed their opponents and Neil Danns threatened with a free-kick, although David Marshall got his positioning perfect to field the ball in his midriff.
But five minutes before half-time Leicester were level when Schlupp bamboozled two Cardiff defenders before finding Howard sliding in at the near post.
Cardiff had an early escape after the restart when Dyer was not closed down, but the midfielder's shot deflected away harmlessly off a blue shirt.
Kiss was putting in an impressive shift for Cardiff in midfield and the young Hungarian worked himself a sight of goal, only to be denied as John Pantsil hurled himself in front of the shot.
But the Foxes were also showing their teeth and Danns caused consternation in the Cardiff defence as he bore down on goal.
Darcy Blake did well to recover and challenge the midfielder before he could shoot, but the ball fell kindly to Dyer who smashed it into the bottom corner.
Back came Cardiff and a period of sustained pressure culminated in a brilliant equaliser from Gestede, who made himself space before unleashing a brilliant, dipping 25-yard shot that left Weale helpless.
Howard and Schlupp had late chances to snatch it for Leicester, but Marshall did well to deny both players and take the game into extra time.
Leicester replacement Yuki Abe's low shot had Marshall scrambling, before Earnshaw flashed a header across the face of goal at the other end.
In the second period Cowie had a free-kick in a promising position but could only send his kick over the bar, while Abe continued to threaten for the Foxes.
But neither side could conjure a winner in open play and penalties were needed to settle the outcome.
The first six penalties all whistled past the keepers, but Fernandes' nerve failed him on Leicester's seventh attempt and his kick went over the bar.
Cardiff captain Quinn stepped up to take responsibility, sending the ball past Weale and the Bluebirds into the fourth round.