United, who had seen Wayne Rooney controversially escape a red card, were on course for the Champions League places until Kim stole in to head home a Peter Whittingham free-kick in the 91st minute.
Surprise 3-2 victors over Manchester City earlier in the season, Cardiff inched three points clear of the bottom three thanks to Kim's goal, while United were left in sixth place, seven points behind leaders Arsenal.
"There's just disappointment that we didn't take all three points in the end," United manager David Moyes told Sky Sports. "But Cardiff made a game of it and put us under some pressure. We gave away a stupid free-kick that led to the goal."
Moyes disagreed that Rooney was fortunate to avoid being sent off after angrily kicking out at Cardiff's Jordon Mutch, saying: "I didn't think it deserved any more than a yellow card."
Rooney lashed out after Mutch ran across his path in the early stages of the game in the Welsh capital, but referee Neil Swarbrick only showed him a yellow card and in the 15th minute the England striker put United ahead.
Antonio Valencia's right-wing centre was flicked on by Javier Hernandez to Rooney, who turned inside and let fly with a shot that beat goalkeeper David Marshall via a deflection off Gary Medel.
Cardiff's fans were furious that Rooney had been allowed to stay on the pitch, but they saw their side draw level in the 33rd minute with a beautifully constructed goal.
Medel found Whittingham, who helped the ball on to Mutch, and he released former United striker Fraizer Campbell to beat goalkeeper David de Gea with a first-time finish.
The hosts' joy was short-lived, however, as Patrice Evra restored the champions' lead on the stroke of half-time when he headed home from Rooney's left-wing corner.
In response, Campbell saw a feathery chip come back off the bar, but United looked to have escaped until they gave away one free-kick too many and Kim dispatched Whittingham's centre to send the stadium into raptures.
For United, extending their unbeaten run to 10 games in all competitions provided scant consolation, particularly as Kim's goal prevented them from supplanting Manchester City in the top four.
Manuel Pellegrini's side had reasserted their title credentials earlier in the day by humiliating fellow championship contenders Tottenham Hotspur 6-0 at the Etihad Stadium.
Beaten 1-0 by Sunderland in their last outing, City took the lead through Jesus Navas after only 14 seconds and did not look back.
The Spanish winger deftly lobbed Spurs goalkeeper Hugo Lloris after the Frenchman had gifted the ball to Sergio Aguero with a loose kick, and an own goal from Sandro in the 34th minute made it 2-0.
Aguero claimed a brace either side of half-time, tucking away centres from Navas and Yaya Toure, to take his tally of goals to 14 in his last 11 City appearances.
Alvaro Negredo added a fifth in the 55th minute, flummoxing Michael Dawson with an audacious turn and lashing a left-foot shot past Lloris, before Navas completed the rout in injury time.
"It is impossible to play better than today. We are working to have one style of playing and to continue in the same way," said City manager Pellegrini.
"We're thinking just about each game. Now we play in the Champions League on Wednesday (against Viktoria Pilsen) and after we see what happens with other teams, how many points they drop, and I'm absolutely sure we will also win matches away."
Victory preserved City's 100 percent home record in the league this season and having annihilated Norwich City 7-0 in their last fixture at the Etihad, they have now scored 13 goals without reply in their last two home games.
Pellegrini's side finished the weekend a point above United in fourth place, while Spurs slipped to ninth. Andre Villas-Boas's men had only conceded six goals all season prior to their trip to Manchester and although they are only two points below City, they have now gone three games without victory.
"Everything went wrong for us, every opportunity was a goal and we paid a heavy price -- too much for what we deserved," said Villas-Boas. "City were excellent, and we were extremely poor. We have to be ashamed of ourselves, and react to a defeat like this."
Photos: Katrina Kaif, Shamita Shetty at Mumbai airport
Photos: Varun Dhawan, Alia Bhatt promote 'Badri...' on 'Dil Hai Hindustani'
In pictures: 15 facts about kissing that will surprise you
Photos: Shahid Kapoor and Mira Rajput at cafe in Bandra
Photos: Deepika Padukone, Neha Dhupia and Soha Ali Khan at event