Everton FC crashed out of the FA Cup in agonising fashion after an epic tie against West Ham United.

The Blues were beaten 9-8 on penalties after a thrilling third round replay ended in a 2-2 draw at Upton Park.

Everton goalkeeper Joel Robles smashed his team's 10th penalty against the crossbar before West Ham counterpart Adrian slotted home the decider after Steven Naismith and Stewart Downing had earlier missed.

It was harsh on Robles, who had kept the 10-man visitors in the tie with a string of excellent saves.

Enner Valencia put the Hammers ahead on 51 minutes and the Blues were reduced to 10 men five minutes later when Aiden McGeady was dismissed for a second bookable offence.

But substitute Kevin Mirallas inspired a remarkable comeback, equalising with a brilliant free-kick on 82 minutes and then creating a goal for the scourge of West Ham, Romelu Lukaku, on 97 minutes before Hammers sub Carlton Cole scored seven minutes from time.

Unusually, West Ham were playing at home in their third-choice colours of all purple, which has also been designated as the special FA Cup kit for this season.

Everton, unchanged from the stirring weekend draw against Manchester City, enjoyed the better of a curiously tame first half without threatening West Ham goalkeeper Adrian.

Indeed, the Blues were indebted to an excellent save from their own keeper to remain level on 12 minutes.

John Stones, attempting to carry possession out of defence, was robbed on the edge of the area by Enner Valencia, who progressed into the area but saw his shot blocked by the alert Joel Robles.

Andy Carroll headed the loose ball against the post but was adjudged offside before tumbling into the crowd and ending up six rows into the away end.

Everton's reluctance to test Adrian was frustrating, so too the regularity with which the visiting forwards were caught offside.

And they were made to pay when the Hammers went ahead six minutes after the interval.

After Romelu Lukaku was ruled offside, a swift home break allowed Carroll to find Valencia inside the area. Allowed too much space by Stones, the Ecuador striker advanced and shot across Robles into the bottom corner.

Everton's task was made more difficult five minutes later when McGeady, booked in the first half, was shown a second yellow after catching Mark Noble with a sliding challenge.

It looked soft, but McGeady should not have given referee Neil Swarbrick the chance to brandish any cards.

Aaron Cresswell was narrowly wide after one barnstorming run before Martinez threw on both Kevin Mirallas and Bryan Oviedo in pursuit of an equaliser.

And only a tremendous block by the stretching James Tomkins prevented Mirallas scoring from a matter of yards on 78 minutes when Lukaku had hounded a mistake out of James Collins.

Robles then saved brilliantly to keep out a Collins header from a Stewart Downing corner, and four minutes later Everton were level.

Collins upended Lukaku on the edge of the area and, with West Ham anticipating a Leighton Baines shot, Mirallas curled a brilliant free-kick into the top corner beyond the failing Adrian.

Stones escaped conceding a penalty when the officials ruled his handball from a Valencia cross was outside rather than inside the box.

Robles made a fine save to keep out Noble's cheeky resultant effort, with the busy Blues keeper then palming over a Kevin Nolan overhead kick.

In extra time, Lukaku wasted a glorious chance when, despite being three yards from an open goal, he failed to connect with either foot.

But seconds later Everton were ahead in the 97 minute. Brilliant play from Mirallas saw him jink beyond three West Ham defenders on the left of the area before crossing low where Lukaku this time made no mistake.

There was another twist in the 113 minute when Carlton Cole, who had only been on two minutes, prodded home after Tomkins nodded down a corner.

In a manic finale, Lukaku powered through the Hammers defence but dragged wide with the goal at his mercy and Robles saved from Morgan Amalfitano and Carroll.

Then came the penalties. And an incredible match became one to forget for Everton.