Match ends, Everton 2, Cardiff City 1.
Everton 2-1 Cardiff City
Cardiff were cruelly denied a point by Seamus Coleman's injury-time winner as the Bluebirds slipped further behind in their bid for Premier League survival.
Goalkeeper David Marshall looked to have earned a draw with a string of saves after Juan Cala had equalised Gerard Deulofeu's deflected effort.
But, after another stop to deny Romelu Lukaku's shot, Marshall was beaten by Coleman's miscue.
Cardiff fell to 19th and are now three points from safety.
The result at Goodison Park was harsh on Ole Gunnar Solskjaer's side, and Marshall especially, after the Scot made four crucial saves to keep his side in the game.
And with only eight league games left, starting at home to Liverpool next Saturday, they are running out of time to try and maintain their top-flight status.
Cardiff complained they were denied a penalty when substitute Wilfried Zaha fell under a challenge from Sylvain Distin but after their eighth successive league defeat away from home, they were the only team among the bottom five that failed to pick up points.
Prior to this game, Solskjaer said his team needed to emulate Wigan in 2012 when the Latics, then under Everton boss Roberto Martinez, won seven of their last nine games.
After Coleman's sliced winner, though, there must be a sense that fortune is against the Bluebirds as they failed to follow-up an important win over fellow strugglers Fulham last weekend.
Everton, on the other hand, kept up their European challenge with this victory, and moved above Manchester United into sixth place.
Having gained only 11 points from 24 available since the turn of the year, there were question marks over Everton's form coming into this game but they can now look forward to five home matches in their season run-in.
They now stand two points behind fifth-placed Tottenham, although the prospect of a Champions League spot still looks remote as they trail fourth-placed Arsenal by eight points.
Martinez's side were on top for the majority of this encounter as Cardiff were indebted to Marshall for three superb first-half saves to deny Kevin Mirallas, Deulofeu and Lukaku.
But Solskjaer, who had started the game with three centre-backs, switched to a back four after 25 minutes and almost saw his side's fortunes change when Fraizer Campbell could not beat the diving Tim Howard after latching onto a ricochet on the edge of the penalty area.
The tactical change led to a more even midfield battle, and Campbell forced Howard into another save at his near post after the break.
It was a sign of Marshall's excellence that when the opener did arrive, it came through a deflection as Deulofeu received the ball on the left flank, skipped past Gary Medel and beat the Scottish goalkeeper at this near post via Steven Caulker's thigh.
The Bluebirds' disappointment did not last long, though, as they equalised when Cala steered in Peter Whittingham's set-piece. Everton complained that the free-kick was a soft one after Coleman's foul on Campbell.
Marshall pulled off his best save of the match to deny Lukaku again, before referee Roger East waved away Zaha's penalty appeals after he fell under a challenge from Sylvain Distin.
But Cardiff's frustration was yet to reach its peak as Coleman latched onto Gareth Barry's header to score a hugely fortunate winner from close-range.
Everton boss Roberto Martinez:
"David Marshall in goal was phenomenal, as good an individual performance as you are going to see from a goalkeeper.
"You can say you get a bit lucky when you score the winner so, so late, but it was down to having that control and patience.
"I did think we deserved the three points but I thought Cardiff deserved huge, huge credit."
Cardiff manager Ole Gunnar Solskjaer: "We feel very disappointed not coming away with one, maybe three points.
"It was a stonewall penalty for Wilfried Zaha when he goes through two or three of them at 1-1. I don't know how many times we have to look at us claiming penalties and not getting it.
"The performance was outstanding, a phenomenal effort. They had 'cojones' as you say."
Visit the BBC Sport Facebook page for a gallery of the best pictures from Saturday's Premier League matches.
- 10DeulofeuSubstituted forMcGeadyat 62'minutes
- 11MirallasSubstituted forNaismithat 62'minutes
- 21OsmanBooked at 58minsSubstituted forBarkleyat 82'minutes
- 35da SilvaSubstituted forZahaat 77'minutes
- 28Théophile-CatherineBooked at 45mins
- 27Torres Ruiz
- 16NooneSubstituted forDaehliat 62'minutes
- 10CampbellBooked at 76mins
- 8MedelBooked at 58mins
- 18MutchSubstituted forWhittinghamat 57'minutes
- Roger East
- Shots on Target
Second Half ends, Everton 2, Cardiff City 1.
Offside, Cardiff City. Kévin Théophile-Catherine tries a through ball, but Cala is caught offside.
Goal! Everton 2, Cardiff City 1. Seamus Coleman (Everton) right footed shot from the centre of the box to the top right corner. Assisted by Gareth Barry with a headed pass.
Attempt blocked. Ross Barkley (Everton) right footed shot from the left side of the box is blocked. Assisted by Romelu Lukaku.
Corner, Everton. Conceded by Declan John.
Attempt missed. Wilfried Zaha (Cardiff City) left footed shot from a difficult angle on the left misses to the left. Assisted by Mats Daehli.
Hand ball by Gary Medel (Cardiff City).
Offside, Everton. Sylvain Distin tries a through ball, but Romelu Lukaku is caught offside.
Ross Barkley (Everton) wins a free kick on the left wing.
Foul by Steven Caulker (Cardiff City).
James McCarthy (Everton) wins a free kick in the attacking half.
Foul by Gary Medel (Cardiff City).
Substitution, Everton. Ross Barkley replaces Leon Osman.
Attempt blocked. Wilfried Zaha (Cardiff City) left footed shot from the centre of the box is blocked.
Corner, Everton. Conceded by Wilfried Zaha.
Corner, Everton. Conceded by David Marshall.
Attempt saved. Romelu Lukaku (Everton) right footed shot from outside the box is saved in the centre of the goal. Assisted by Seamus Coleman.
Substitution, Cardiff City. Wilfried Zaha replaces Fabio.
Fraizer Campbell (Cardiff City) is shown the yellow card.
Attempt blocked. Romelu Lukaku (Everton) left footed shot from the left side of the box is blocked. Assisted by Leon Osman.
Foul by Romelu Lukaku (Everton).
Kévin Théophile-Catherine (Cardiff City) wins a free kick in the defensive half.
Attempt missed. Leon Osman (Everton) right footed shot from the left side of the box misses to the right.
Attempt missed. Seamus Coleman (Everton) right footed shot from outside the box misses to the left. Assisted by Aiden McGeady following a fast break.
Goal! Everton 1, Cardiff City 1. Cala (Cardiff City) with an attempt from the centre of the box to the bottom left corner. Assisted by Peter Whittingham with a cross following a set piece situation.
Foul by Seamus Coleman (Everton).
Fraizer Campbell (Cardiff City) wins a free kick in the attacking half.
Leighton Baines (Everton) wins a free kick in the defensive half.
Foul by Kim Bo-Kyung (Cardiff City).
Substitution, Everton. Steven Naismith replaces Kevin Mirallas.
Attempt blocked. Aiden McGeady (Everton) left footed shot from outside the box is blocked. Assisted by Seamus Coleman.
Substitution, Cardiff City. Mats Daehli replaces Craig Noone.
Substitution, Everton. Aiden McGeady replaces Gerard Deulofeu.
Goal! Everton 1, Cardiff City 0. Gerard Deulofeu (Everton) right footed shot from the left side of the box to the bottom left corner.
Leon Osman (Everton) wins a free kick in the defensive half.
Foul by Kim Bo-Kyung (Cardiff City).
Leon Osman (Everton) is shown the yellow card.
Gary Medel (Cardiff City) is shown the yellow card.
Foul by Leighton Baines (Everton).