Cardiff took a fluke lead through Lee Naylor’s 40-yard strike but Paulo Sousa’s side put in an impressive second 45 minutes to battle back and gain revenge for last season’s play-off semi-final defeat.
Cardiff were without a strikeforce most Premier League sides would envy, as Michael Chopra, Jay Bothroyd and Craig Bellamy all nursed injuries.
And after bossing the opening period they faded badly and never looked like earning a draw as their unbeaten start came to an end.
With both sides fielding a solitary central striker, it was Cardiff who won the midfield battle in the opening exchanges, and Jason Koumas had the first effort but his low shot lacked power and was easily held by Carl Ikeme in the Foxes goal.
Both sides were trying to play football and it was the visitors who went ahead in spectacular fashion in the 26th minute.
Koumas cushioned a fabulous first-time pass out wide and the overlapping Naylor took one touch before thrashing the ball from 40 yards over Ikeme’s head and into the top corner.
The former Celtic full-back was mobbed by his team-mates and may claim it was deliberate, but his effort was surely a mishit cross.
Either way the goal injected life into the Bluebirds and Koumas threatened again with another long-range strike before Peter Whittingham’s delightful flick teed up Andy Keogh for a curler into Ikeme’s arms.
A Martyn Waghorn corner almost delivered an equaliser when Michael Morrison headed across goal and Steve Howard flicked on, only to see Cardiff captain Mark Hudson stretch to head clear.
The interval brought a brief storm and added impetus from the hosts, with Waghorn shooting wide from the edge of the area after another direct run.
And moments later Sousa’s side were rewarded for their bright start when King headed the 51st-minute equaliser.
Waghorn was again involved on the right and when he recycled play inside to Richie Wellens, the former Blackpool man delivered a teasing cross which King stormed onto to plant a powerful header past David Marshall and into the roof of the net.
Leicester were on top and took a deserved lead in the 68th minute thanks to another excellent King goal.
Again Wellens was the architect and when he found space on the corner of the area he quickly squared the ball to Lloyd Dyer.
The winger cleverly ran over the ball to allow the arriving King to sweep a shot over Marshall’s head from the edge of the area.
Dyer then wasted a golden chance when Marshall fluffed a kick straight at his feet but the winger could only hit the post from 10 yards.
Japanese midfielder Yuki Abe made his debut late on as the Foxes saw out an important win.