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.
Mark PoyserBBC Wales football reporter
"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."
Full Time The referee signals the end of the game.
Craig Conway fouled by Paul Konchesky, the ref awards a free kick. Free kick taken by Aron Gunnarsson.
Paul Konchesky challenges Craig Conway unfairly and gives away a free kick. Direct free kick taken by Aron Gunnarsson.
Unfair challenge on Mark Hudson by Wes Morgan results in a free kick. David Marshall takes the free kick.
Inswinging corner taken by Martyn Waghorn, Rudy Gestede manages to make a clearance.
The ball is swung over by Andy King, Ben Turner makes a clearance.
The ball is sent over by Martyn Waghorn, Ben Turner makes a clearance.
Paul Konchesky crosses the ball, blocked by Craig Conway.
Foul by Rudy Gestede on Zak Whitbread, free kick awarded. Indirect free kick taken by Paul Konchesky.
The ball is sent over by Paul Konchesky, Mark Hudson makes a clearance.
Rudy Gestede gives away a free kick for an unfair challenge on Wes Morgan. Indirect free kick taken by Danny Drinkwater.
Free kick awarded for an unfair challenge on Danny Drinkwater by Craig Conway. Indirect free kick taken by Danny Drinkwater.
Ben Marshall takes a shot. Blocked by Andrew Taylor.
Booking Peter Whittingham receives a caution.
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.
Substitution Aron Gunnarsson is brought on as a substitute for Jordon Mutch.
The ball is sent over by Jesse Lingard, clearance by Matthew Connolly.
The ball is crossed by Jesse Lingard, clearance made by Mark Hudson.
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.
Centre by Andrew Taylor.
Andy King takes a shot. Blocked by Mark Hudson.
Substitution Jesse Lingard on for Lloyd Dyer.
Substitution Ben Marshall comes on in place of Anthony Knockaert.
Craig Bellamy is caught offside. Free kick taken by Kasper Schmeichel.
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.
Booking Caution for Matthew Connolly.
Matthew Connolly challenges Martyn Waghorn unfairly and gives away a free kick. Martyn Waghorn takes the indirect free kick.
Corner taken by Peter Whittingham from the right by-line played to the near post, Danny Drinkwater makes a clearance.
Don Cowie gives away a free kick for an unfair challenge on Lloyd Dyer. Martyn Waghorn takes the free kick.
David Nugent produces a curled right-footed shot from 25 yards. Save by David Marshall.
Andy King fouled by Jordon Mutch, the ref awards a free kick. Danny Drinkwater restarts play with the free kick.
Substitution Don Cowie joins the action as a substitute, replacing Bo-Kyung Kim.
Martyn Waghorn produces a left-footed shot from 35 yards and missed to the left of the net.
Lloyd Dyer takes a shot. Andrew Taylor gets a block in.
Ritchie De Laet sends in a cross, Martyn Waghorn takes a shot. Save made by David Marshall.
David Marshall makes a clearance.
Substitution Rudy Gestede comes on in place of Heidar Helguson.
Inswinging corner taken by Martyn Waghorn,
Substitution Martyn Waghorn joins the action as a substitute, replacing Jamie Vardy.
Bo-Kyung Kim concedes a free kick for a foul on Anthony Knockaert. Martyn Waghorn restarts play with the free kick.
The ball is sent over by Lloyd Dyer, clearance made by Peter Whittingham.
Bo-Kyung Kim delivers the ball, Kasper Schmeichel makes a save.
Foul by Jamie Vardy on Peter Whittingham, free kick awarded. David Marshall takes the free kick.
The game restarts for the second half.
45:00 +1:28 Half time
Half Time The half-time whistle blows.
Paul Konchesky sends in a cross, Jamie Vardy has a headed effort from close in and clears the bar.
Free kick awarded for a foul by Anthony Knockaert on Peter Whittingham. David Marshall restarts play with the free kick.
Andrew Taylor is penalised for handball and concedes a free kick. Indirect free kick taken by Ritchie De Laet.
Andy King has shot on goal from just outside the box which goes wide of the right-hand upright.
The ball is crossed by Paul Konchesky, save made by David Marshall.
Booking The referee shows Ben Turner a yellow card for unsporting behaviour.
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.
Andrew Taylor takes a shot. Wes Morgan gets a block in.
Jamie Vardy takes a shot. Blocked by Mark Hudson.
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.
A cross is delivered by Lloyd Dyer, Bo-Kyung Kim manages to make a clearance.
Foul by Jamie Vardy on Jordon Mutch, free kick awarded. Peter Whittingham takes the direct free kick.
Andrew Taylor crosses the ball.
Paul Konchesky challenges Craig Conway unfairly and gives away a free kick. Free kick crossed by Peter Whittingham, clearance by Ritchie De Laet.
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.
Craig Conway crosses the ball, Ritchie De Laet makes a clearance.
Anthony Knockaert takes a shot. David Marshall makes a save.
Centre by Craig Bellamy, Andy King manages to make a clearance.
A cross is delivered by Craig Conway.
Peter Whittingham gives away a free kick for an unfair challenge on Danny Drinkwater. Indirect free kick taken by Danny Drinkwater.
The ball is sent over by Jamie Vardy.
David Nugent takes a shot. Ben Turner gets a block in.
Anthony Knockaert takes a shot. Save by David Marshall. The ball is crossed by Ritchie De Laet, Ben Turner makes a clearance.
The official flags David Nugent offside. David Marshall takes the indirect free kick.
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.
David Nugent takes a shot. David Marshall makes a save.
Craig Bellamy challenges Danny Drinkwater unfairly and gives away a free kick. Danny Drinkwater takes the free kick.
The ball is swung over by Andrew Taylor, blocked by Ritchie De Laet.
Effort by Danny Drinkwater from a long way out goes over the crossbar.
The ball is crossed by Craig Bellamy, save made by Kasper Schmeichel.
Jordon Mutch challenges David Nugent unfairly and gives away a free kick. Direct free kick taken by Danny Drinkwater.
Free kick awarded for an unfair challenge on Lloyd Dyer by Matthew Connolly. Lloyd Dyer restarts play with the free kick.
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.