Seamus Coleman was the hero at Goodison as his late winner moved Everton within two points of fifth-placed Tottenham Hotspur.
The Republic of Ireland international struck deep into second-half stoppage time to nick a 2-1 win for the Blues which catapulted them back above Manchester United and into the European qualification positions.
It was a somewhat fortuitous finish from Coleman as his miscued volley looped into the Gwladys Street net – but the outcome was all that mattered.
The overriding feeling amongst the Goodison faithful at full-time was relief after Cardiff had seemed to battle their way to an unlikely draw when Juan Cala equalised 23 minutes before the end to cancel out Gerard Deulofeu’s opener just before the hour mark.
Deulofeu celebrates his opening goal.
Phil Jagielka and Steven Pienaar failed to shake off their injury problems so John Stones once again lined-up at centre-half and Deulofeu stepped up from the bench to play on the right wing.
In total, Roberto Martinez made three alterations to the side that lined-up at the Emirates Stadium a week earlier. Tim Howard returned in goal and Leon Osman replaced Ross Barkley.
Osman was named skipper and he wasn’t too far away with an early drive as the Blues began the contest in a positive fashion.
Inside the first five minutes, Kevin Mirallas brought a full-stretch diving save out of Cardiff stopper David Marshall and, from the resulting corner, Romelu Lukaku stabbed narrowly over the bar after a mini-goalmouth scramble.
Ambitious long-range attempts from Gary Medel and Leighton Baines then followed but neither were of trouble to the respective goalkeepers.
Mirallas’ influence in the game, from a roaming free role, grew as the first half progressed. Having volleyed over and curled wide, the Belgian was thwarted when his shot from just inside the box was bravely blocked by Juan Cala and, from a similar position, Deulofeu was denied by an excellent fingertip save from Marshall on the half-hour mark.
It was the same again moments later as this time the Scotland international flew to his right to push Lukaku’s rampaging run-and-shot behind for a corner.
The two managers watch on.
Marshall’s impressive display kept the game goalless at the interval. Everton had bossed the opening 45 minutes, though Cardiff had threatened on the odd occasion.
Campbell tested the Toffees keeper again shortly after the restart but the American was equal to the effort, diving low to his left to turn the ball behind for a corner.
Cardiff were much more adventurous at the start of the second half but their resistance was broken on 58 minutes when Everton took the lead through Deulofeu.
The jet-heeled Spaniard escaped down the left channel, powered into the penalty area and beat Marshall at his near post with the aid of a slight deflection off Steven Caulker.
McCarthy and Mutch challenge for possession.
It was Deulofeu’s last involvement as he was replaced moments later by Aiden McGeady in a double change by Martinez which also saw Steven Naismith introduced at the expense of Mirallas.
Everton’s advantage didn’t last long, however, as Cala drew the visitors back level with a scrappy equalising goal on 67 minutes.
A free-kick from the left was curled in by substitute Peter Whittingham and the Spanish centre-half managed to bundle the ball into the net off a combination of his knee and chest.
Everton rallied from the setback and probed again in the final quarter of the match, with Ross Barkley sent on from the bench to inject some extra energy.
It seemed there was no way past the outstanding Marshall for a second time as the Cardiff glovesman continued to make top-drawer saves, denying both Lukaku and Barkley late on.
But he was left totally deceived when, in the last of the four minutes added time, McGeady crossed from the left, Barry headed down and Coleman’s volley spun off the outside of his boot and into the net, sending Goodison wild.