Seamus Coleman sliced an injury-time winner as Everton condemned relegation-threatened Cardiff to a heart-breaking 2-1 defeat at Goodison Park.
The heroics of goalkeeper David Marshall looked to have earned a crucial Premier League point for the Welsh side, but the Scot cut a dejected figure after being beaten by Coleman's miskick.
Marshall produced a number of fine saves and it took a deflected 59th-minute strike from Gerard Deulofeu to beat him. Even then he looked set to earn a point after Juan Cala bundled in a scrappy equaliser.
Everton were clearly the superior side and will feel their victory, which will breathe life back into their European push, was deserved.
But the manner of defeat will be hard to take for the Bluebirds, who face an increasing struggle to stay up.
Cardiff, with Kevin Theophile-Catherine coming in for striker Kenwyne Jones, played a flat five-man defence in an apparent attempt to stifle Everton.
Yet from the outset it appeared to invite pressure and Marshall produced his first fine save to deny Kevin Mirallas after the Belgian had run across the area and cut back to shoot.
Cardiff then got in a muddle defending a corner and, luckily for them, Steven Caulker's attempted clearance ricocheted off Romelu Lukaku over the bar and not on target.
Leon Osman and Leighton Baines both shot over for Everton and Deulofeu appeared to be tripped in the area by Cala, but there were no home complaints.
A good move down the right saw Coleman and Lukaku set up another chance for Mirallas but Cala dived across to block.
Cardiff had their first clear-cut chance just before the half-hour when a pass from attack-minded Fabio deflected off two defenders into the path of Fraizer Campbell, but Tim Howard produced a good reaction save.
Marshall matched Howard barely moments later as he dived to his right to keep out a low effort from Barcelona loanee Deulofeu.
The Scottish keeper bettered that soon after as he palmed away a powerful Lukaku strike that seemed destined for the top corner.
Cardiff were arguably fortunate to end the first half with 11 men after Theophile-Catherine caught Gareth Barry late with a rash challenge.
Referee Roger East allowed Everton to play advantage at the time but later went back to book an apologetic Theophile-Catherine.
Everton looked to step up the tempo after the break and Lukaku had a close-range effort blocked, but Campbell was also denied by Howard after a quick Cardiff counter-attack.
East got his yellow card out again after Gary Medel and Osman got into a tangle and then confronted each other but the situation soon calmed down.
Everton got back to business and were finally rewarded for their dominance when Deulofeu took possession on the left, ran unchallenged to the six-yard box and beat Marshall with a shot wickedly deflected off Caulker.
Cardiff responded and Everton's defence - still lacking injured England international Phil Jagielka - were caught out as Peter Whittingham swung in a free-kick and Cala turned in the equaliser off his thigh and chest.
The Toffees might immediately have reclaimed the lead but Osman's strike flew across goal.
Marshall then came to their rescue again with another excellent stop after Lukaku's strike from the edge of the area took a tricky deflection off Theophile-Catherine.
Another good chance looked to be falling to James McCarthy but the Ireland international completely miskicked. Cardiff, who sent on Wilfried Zaha, fought on and Campbell dispossessed Stones but the defender recovered to deny him a shot.
Zaha appealed for a penalty after being challenged by Distin but East waved play on. Marshall saved Cardiff again in injury time by blocking a Ross Barkley header but Coleman's mishit shot from a Barry header wrong-footed him.