Victor Camarasa's stunning stoppage-time strike earned Cardiff a vital 1-0 win at Leicester after Neil Etheridge's inspired display.
The goalkeeper saved James Maddison's second-half penalty before Camarasa struck from 25 yards.
Philippines international Etheridge pulled off a string of fine saves to help earn the Bluebirds a precious victory – their first away in the league this term – in their battle against the drop.
He denied Ricardo Pereira, Jamie Vardy and Maddison to lift Cardiff four points above the Premier League relegation zone.
Leicester failed to earn a third successive win after Christmas victories over Chelsea and Manchester City.
Regular penalty taker Jamie Vardy was substituted just six minutes before Maddison's spot-kick miss, with the decision jeered by the home fans.
Despite his later efforts Etheridge was almost beaten by his own man inside the first five minutes.
Greg Cunningham intercepted Demarai Gray's ball, intending to play it back to his goalkeeper. But the defender only succeeded in passing it beyond the advancing Etheridge and was relieved to see it roll just wide.
Sean Morrison then headed over while Etheridge turned Maddison's low effort wide as the teams traded half chances.
Cardiff were the brighter side early on, despite the hosts creating the better openings, as Neil Warnock's team dominated possession.
However the Foxes slowly gained a degree of control. Maddison's influence grew and, aside from seeing Etheridge save his free kick, his trickery in the middle began to open up space for the hosts.
Cardiff's midfield struggled to deal with the England Under-21 international but Etheridge remained equal to everything.
First, he turned Pereira's low effort away and four minutes before the break denied Vardy.
Maddison slipped the striker in but Etheridge thwarted him and Nampalys Mendy could not convert the follow-up.
Gray also fired at Etheridge just before half-time and the goalkeeper needed to be alert three minutes after the restart to produce an excellent reaction stop from Pereira.
The Foxes were on top but Josh Murphy tested Kasper Schmeichel with a low drive after 65 minutes and the winger sliced wildly wide two minutes later when Junior Hoilett's shot deflected to him.
Vardy was then replaced by Kelechi Iheanacho – and with penalty taker Vardy off the pitch the Foxes blew a golden chance with 16 minutes left after Maddison was bundled over by a clumsy Morrison challenge.
The player picked himself up to take the penalty but Etheridge guessed low to his right to save the spot-kick.
Sol Bamba blocked Rachid Ghezzal's effort but the Foxes failed to find a breakthrough and were punished in added time.
Bobby Reid teed up Camarasa in space and he brilliantly curled the ball into the top corner from 25 yards.
ga('create', 'UA-72310761-1', 'auto', {'name': 'pacontentapi'});
ga('pacontentapi.set', 'referrer', location.origin);
ga('pacontentapi.set', 'dimension1', 'By Nick Mashiter, Press Association Sport');
ga('pacontentapi.set', 'dimension2', '2d74299a-c92d-4ddc-b5fd-9bd59bba7773');
ga('pacontentapi.set', 'dimension3', 'paservice:sport,paservice:sport:club-news,paservice:sport:football,paservice:sport:match-reports,paservice:sport:uk,paservice:sport:world');
ga('pacontentapi.set', 'dimension6', 'story');
ga('pacontentapi.set', 'dimension7', 'composite');
ga('pacontentapi.set', 'dimension8', null);
ga('pacontentapi.set', 'dimension9', 'sport:football');
ga('pacontentapi.send', 'pageview', { 'location': location.href, 'page': (location.pathname + location.search + location.hash), 'title': 'Camarasa and Etheridge star in Cardiff\u2019s win at Leicester'});