Cardiff restored a three-point lead at the top of the Championship thanks to Craig Bellamy's goal.
Leicester had threatened to overrun their visitors and only a combination of the woodwork and David Marshall's fine goalkeeping denied the Foxes.
But when Cardiff countered, Bellamy dropped off his markers to clip a first-time shot into the bottom corner.
Andy King, in particular, was unlucky not to equalise as Leicester pressed, but Cardiff held firm.
Leicester, looking to consolidate their position in the play-off places, had clicked into gear early and peppered Cardiff's goal.
First David Nugent got free down the right and the Foxes striker hit a crisp shot at goal from a tight angle that Marshall did well to get a hand to.
"It wasn't pretty but the scoreline is all that matters. Craig Bellamy's early goal was the difference as Cardiff survived the rain and seemingly endless Leicester pressure. The Foxes will feel hard done-by after hitting the bar twice, the post once and forcing Cardiff into two goal-line clearances."
The Scotland goalkeeper then pulled off a spectacular reaction save from the resulting corner, after Wes Morgan was allowed a free header at the back post.
King then almost punished his countrymen when the Leicester and Wales midfielder saw his curling shot cannon off Marshall's left-hand post.
Jamie Vardy stabbed the rebound against the crossbar, but the striker had already strayed into an offside position.
Anthony Knockaert was the next to test Marshall, the French winger twice sending long-range shots dipping and swerving towards the Bluebirds stopper.
It seemed it would only be a matter of time before Leicester took the lead, but instead Cardiff hit their hosts with almost their first meaningful attack.
Craig Conway did well to stretch Leicester down the right and then pulled the ball back for Bellamy, lurking on the edge of the area, to shoot low across Kasper Schmeichel into the far corner.
Cardiff turned the screw and Morgan did well to tackle Bellamy as he surged into the box, before the former Liverpool striker ballooned the ball over the bar from a tight angle with Schmeichel out of position after punching clear.
The goal against the run of play knocked Leicester's confidence but as half-time approached some of the Foxes' early swagger returned.
King, after surging into the Cardiff half, was unfortunate to see his shot swerve just the wrong side of the post, then Vardy's glancing header clipped the top of the bar.
DID YOU KNOW?
- Cardiff's last victory on Leicester turf was 1-0 in the first leg of the Championship play-off semi-final in May 2010, when Peter Whittingham scored the only goal.
Leicester again started quickly after the break, but Cardiff almost hit them with a second sucker-punch.
Bellamy did well to shield the ball after chasing down a long punt but his intended lay-off to Heidar Helguson was short, allowing Morgan to make a crucial interception.
Martyn Waghorn came off the bench for Leicester - returning to action just 10 days after having his appendix removed - to replace Vardy and the striker tested Marshall with a lobbed header.
Leicester had another let-off when Rudy Gestede, on for Helguson, stooped to head at goal only to see it deflect over the bar off a defender's shoulder.
Both sides continued to threaten as the game became stretched, although the excellent defensive work of Leicester's Morgan was matched at the other end by Cardiff captain Mark Hudson, back after suspension.
Cardiff could have made the game safe with a swift counter-attack but Bellamy's cross for Aron Gunnarsson was deflected just behind the Iceland international.
Leicester next face a similarly tricky match away to promotion rivals Hull City on Boxing Day, while Cardiff head for home and a clash with another side snapping at their heels in Crystal Palace.
Leicester manager Nigel Pearson: "When you create as many goalscoring opportunities as we did you would expect to score.
"But today we came up against a side that, to be fair to them, defended well and had a lot of experience.
"They hit us with a sucker punch and in the second half it fizzled out a little bit. It was a frustrating day."
Cardiff manager Malky Mackay: "This was a really big win for us after losing to Peterborough and it was smashing the way we bounced back from that. I'm delighted.
"We knew we were coming to play a very good team and that it was going to be tough. But I think this was a great advert for the Championship - and I'm not saying that just because we won.
"It was two teams playing attractive football and at a hell of a tempo."
Live Text Commentary
Full Time The referee signals the end of the game.90:00 +3:21
Craig Conway fouled by Paul Konchesky, the ref awards a free kick. Free kick taken by Aron Gunnarsson.90:00 +2:46
Paul Konchesky challenges Craig Conway unfairly and gives away a free kick. Direct free kick taken by Aron Gunnarsson.90:00 +1:04
Unfair challenge on Mark Hudson by Wes Morgan results in a free kick. David Marshall takes the free kick.90:00 +0:38
Inswinging corner taken by Martyn Waghorn, Rudy Gestede manages to make a clearance.90:00 +0:23
The ball is swung over by Andy King, Ben Turner makes a clearance.89:09
The ball is sent over by Martyn Waghorn, Ben Turner makes a clearance.88:33
Paul Konchesky crosses the ball, blocked by Craig Conway.85:19
Foul by Rudy Gestede on Zak Whitbread, free kick awarded. Indirect free kick taken by Paul Konchesky.84:30
The ball is sent over by Paul Konchesky, Mark Hudson makes a clearance.84:05
Rudy Gestede gives away a free kick for an unfair challenge on Wes Morgan. Indirect free kick taken by Danny Drinkwater.82:13
Free kick awarded for an unfair challenge on Danny Drinkwater by Craig Conway. Indirect free kick taken by Danny Drinkwater.81:02
Ben Marshall takes a shot. Blocked by Andrew Taylor.78:38 Booking
Booking Peter Whittingham receives a caution.77:57
Craig Bellamy sends in a cross, Rudy Gestede takes a shot. Zak Whitbread gets a block in. Foul by Peter Whittingham on David Nugent, free kick awarded. Wes Morgan takes the free kick.75:07 Substitution
Substitution Aron Gunnarsson is brought on as a substitute for Jordon Mutch.74:06
The ball is sent over by Jesse Lingard, clearance by Matthew Connolly.73:53
The ball is crossed by Jesse Lingard, clearance made by Mark Hudson.72:19
The ball is delivered by Ritchie De Laet, Matthew Connolly manages to make a clearance. Corner taken by Ben Marshall from the left by-line, David Nugent takes a shot. Clearance made by Andrew Taylor.71:40
Centre by Andrew Taylor.
Andy King takes a shot. Blocked by Mark Hudson.67:28 Substitution
Substitution Jesse Lingard on for Lloyd Dyer.67:28 Substitution
Substitution Ben Marshall comes on in place of Anthony Knockaert.66:49
Craig Bellamy is caught offside. Free kick taken by Kasper Schmeichel.63:23
The ball is sent over by Rudy Gestede, blocked by Ritchie De Laet. Short corner taken by Craig Bellamy. The ball is delivered by Craig Conway, Mark Hudson takes a shot. Inswinging corner taken by Peter Whittingham from the right by-line played to the near post, clearance made by Danny Drinkwater. The referee blows for offside against Rudy Gestede. Kasper Schmeichel restarts play with the free kick.60:58 Booking
Booking Caution for Matthew Connolly.60:50
Matthew Connolly challenges Martyn Waghorn unfairly and gives away a free kick. Martyn Waghorn takes the indirect free kick.59:24
Corner taken by Peter Whittingham from the right by-line played to the near post, Danny Drinkwater makes a clearance.57:52
Don Cowie gives away a free kick for an unfair challenge on Lloyd Dyer. Martyn Waghorn takes the free kick.56:40
David Nugent produces a curled right-footed shot from 25 yards. Save by David Marshall.55:57
Andy King fouled by Jordon Mutch, the ref awards a free kick. Danny Drinkwater restarts play with the free kick.54:12 Substitution
Substitution Don Cowie joins the action as a substitute, replacing Bo-Kyung Kim.54:12
Martyn Waghorn produces a left-footed shot from 35 yards and missed to the left of the net.53:45
Lloyd Dyer takes a shot. Andrew Taylor gets a block in.52:29
Ritchie De Laet sends in a cross, Martyn Waghorn takes a shot. Save made by David Marshall.50:45
David Marshall makes a clearance.50:45 Substitution
Substitution Rudy Gestede comes on in place of Heidar Helguson.50:45
Inswinging corner taken by Martyn Waghorn,49:49 Substitution
Substitution Martyn Waghorn joins the action as a substitute, replacing Jamie Vardy.49:49
Bo-Kyung Kim concedes a free kick for a foul on Anthony Knockaert. Martyn Waghorn restarts play with the free kick.49:06
The ball is sent over by Lloyd Dyer, clearance made by Peter Whittingham.46:23
Bo-Kyung Kim delivers the ball, Kasper Schmeichel makes a save.45:50
Foul by Jamie Vardy on Peter Whittingham, free kick awarded. David Marshall takes the free kick.45:01
The game restarts for the second half.45:00 +1:28 Half time
Half Time The half-time whistle blows.45:00 +0:49
Paul Konchesky sends in a cross, Jamie Vardy has a headed effort from close in and clears the bar.44:42
Free kick awarded for a foul by Anthony Knockaert on Peter Whittingham. David Marshall restarts play with the free kick.41:06
Andrew Taylor is penalised for handball and concedes a free kick. Indirect free kick taken by Ritchie De Laet.40:09
Andy King has shot on goal from just outside the box which goes wide of the right-hand upright.38:42
The ball is crossed by Paul Konchesky, save made by David Marshall.37:29 Booking
Booking The referee shows Ben Turner a yellow card for unsporting behaviour.36:46
The ball is delivered by Lloyd Dyer, Matthew Connolly gets a block in. Outswinging corner taken left-footed by Anthony Knockaert from the left by-line, clearance by Heidar Helguson. Unfair challenge on Wes Morgan by Ben Turner results in a free kick. Anthony Knockaert takes the free kick.36:13
Andrew Taylor takes a shot. Wes Morgan gets a block in.35:55
Jamie Vardy takes a shot. Blocked by Mark Hudson.33:22
Centre by Anthony Knockaert, Andrew Taylor gets a block in. Ritchie De Laet delivers the ball, Mark Hudson makes a clearance. Outswinging corner taken by Anthony Knockaert from the right by-line. The ball is crossed by Craig Conway, Andrew Taylor manages to make a clearance. Matthew Connolly challenges David Nugent unfairly and gives away a free kick. Danny Drinkwater takes the indirect free kick.32:31
A cross is delivered by Lloyd Dyer, Bo-Kyung Kim manages to make a clearance.30:02
Foul by Jamie Vardy on Jordon Mutch, free kick awarded. Peter Whittingham takes the direct free kick.27:08
Andrew Taylor crosses the ball.25:50
Paul Konchesky challenges Craig Conway unfairly and gives away a free kick. Free kick crossed by Peter Whittingham, clearance by Ritchie De Laet.24:37
Assist on the goal came from Craig Conway.24:37 Goal scored
Goal! - Craig Bellamy - Leicester 0 - 1 Cardiff Craig Bellamy grabs a goal from inside the penalty area to the bottom left corner of the goal. Leicester 0-1 Cardiff.24:27
Craig Conway crosses the ball, Ritchie De Laet makes a clearance.22:29
Anthony Knockaert takes a shot. David Marshall makes a save.21:32
Centre by Craig Bellamy, Andy King manages to make a clearance.19:05
A cross is delivered by Craig Conway.17:54
Peter Whittingham gives away a free kick for an unfair challenge on Danny Drinkwater. Indirect free kick taken by Danny Drinkwater.17:24
The ball is sent over by Jamie Vardy.16:14
David Nugent takes a shot. Ben Turner gets a block in.15:46
Anthony Knockaert takes a shot. Save by David Marshall. The ball is crossed by Ritchie De Laet, Ben Turner makes a clearance.14:33
The official flags David Nugent offside. David Marshall takes the indirect free kick.12:54
Andy King takes a shot. Peter Whittingham gets a block in. Outswinging corner taken left-footed by Anthony Knockaert from the left by-line, Wes Morgan takes a shot. David Marshall makes a save. Andy King has an effort at goal from the edge of the box hitting the post.11:58
David Nugent takes a shot. David Marshall makes a save.8:40
Craig Bellamy challenges Danny Drinkwater unfairly and gives away a free kick. Danny Drinkwater takes the free kick.7:56
The ball is swung over by Andrew Taylor, blocked by Ritchie De Laet.6:19
Effort by Danny Drinkwater from a long way out goes over the crossbar.3:34
The ball is crossed by Craig Bellamy, save made by Kasper Schmeichel.1:04
Jordon Mutch challenges David Nugent unfairly and gives away a free kick. Direct free kick taken by Danny Drinkwater.0:30
Free kick awarded for an unfair challenge on Lloyd Dyer by Matthew Connolly. Lloyd Dyer restarts play with the free kick.0:00
The referee gets the game started.
Live data and text provided by our data suppliers