It was the clash of the Premier League's highest scorers and the game didn't disappoint with chance after chance, mostly for the hosts after half-time.
Foxes youngster Joe Dodoo gave Claudio Ranieri's side the lead after just six minutes.
But Mauro Zarate levelled things up 20 minutes later, his 25-yard effort taking a wicked deflection to wrong-foot Mark Schwarzer in the Leicester goal.
Hammers pay the penalty
The second half saw Leicester on top but they could not find a way past in form Hammers 'keeper Adrian, who made save after save.
Slaven Bilic's side had two blatant penalties turned down, Mark Noble even inexplicably booked for diving for the second.
They would have changed the complexion of the match, but Leicester kept pushing and eventually found a way past Adrian after 117 minutes of football when Andy King headed home Fuchs' pinpoint cross.
It comes as something of a wake-up call for West Ham, who beat Premier League leaders Manchester City 2-1 on Saturday night.
Here's how West Ham's players fared against Leicester City.
Adrian – 9
There were some question marks over whether Bilic would give Darren Randolph the cup games this season, particularly after the understudy lost his place to number one Adrian on his return from suspension against City. But the Spaniard was so good at the Etihad, Bilic kept him in as part of a strong side at the King Power. And my how he justified the decision with a string of saves to keep West Ham in the game at 1-1. The Foxes' finishing wasn't the best, but Adrian was like a one-man wall from the second half onwards, making stop after stop. He could do nothing about Andy King's winner, though.
Jenkinson – 5
A poor performance from Jenkinson, who is having a peculiar season so far. He was one of West Ham's best players last season, but seems like he is yet to get going this time around on loan from Arsenal. Hammers fans are used to seeing him bomb forward with purpose to help the attack, but he hardly got forward all night and the cross for the winning goal came from him not shutting down his man on the right.
Tomkins – 6
Was tormented by Leicester's forwards all night and while he did ok when in possessio,n just didn't look comfortable. Got turned around a few times as the game wore on and looked vulnerable with a lack of protection from midfield. Was grateful to partner James Collins for bailing him out on a few occasions. Switched to a central midfield role late on as Bilic shuffled his pack and did well enough in the middle of the park.
Collins – 7
Came on as a late sub to help see out West Ham's win at City last time out and was handed a start here. Looked very rusty early on, having not started a match since the Hammers' ill-fated Europa League game against FC Astra. Caught for pace for Leicester's first but grew into the game and was West Ham's best defender on the night. Will be interesting to see if Bilic keeps him or Tomkins in for the Norwich game at the weekend.
Cresswell – 5
Cresswell tried to get up and down and went close with a first half free-kick, but both he and Jenkinson failed to cut the supply from wide to the strikers or get forward and support the attack like they did so magnificently last season. Was beaten in the air at the far post by King for the winner. Looked like the exertions of City caught up with him and a few others.
Moses – 6
After fantastic performances against Newcastle United and City, where he also scored, this game probably showed why Jose Mourinho was happy to let Moses leave Chelsea on loan once again. While he was always trying his best to create or score a goal, he often lost the ball and could not get into his rhythm. That lack of consistency is why West Ham were able to sign him, although getting the 120 minutes under his belt will help boost his match fitness. Like Noble, was really unlucky not to have been given a penalty after tricking his way into the box in the second half with the score at 1-1.
Noble – 6.5
Despite a few passes going astray, Noble was probably West Ham's best outfield player against Leicester, which says a lot because he didn't have the best of games. The captain was at the heart of most things Bilic's side tried to do and was desperately unlucky not to get what looked a cast iron penalty in extra-time. He was instead booked for diving for the first time in his career.
Obiang – 6
Saw lots of the ball, but had a mixed game. Showed glimpses of the impressive energy and passing he possesses, but was often crowded out by the opposition. Gave the ball away in some dangerous areas as the game wore on and was eventually substituted for Winston Reid with seven minutes left as Bilic tried to scrape through to penalties.
Lanzini – 6
The little Argentine was very bright in the first half and saw a lot of the ball. He was involved in the move which led to Zarate's goal, which is what he is on the pitch for. Ran all night and kept working for the team but tailed off and tired towards the end as Leicester laid siege to the West Ham goal.
Zarate – 6.5
Always looking for the ball and trying to make things happen. Got a goal on his return to the side after injury, albeit via a massive deflection, but if you don't buy a ticket you won't win the raffle. Played well in spells but was substituted on 75 minutes for Cheikhou Kouyate.
Carroll – 5
Long awaited first start since January was a damp squib. Never got into the game and looked extremely rusty, as is to be expected. Miscontrolled the ball on several occasions when West Ham were building promising attacks and his lack of mobility was in stark contrast to what Diafra Sakho offers Bilic's side. Whether he was disappointed with what he saw or was simply being careful with the striker's fitness, Bilic took the former England man off after an hour to send on Dimitri Payet.
Payet – 6
Showed flashes of brilliance and improved West Ham's attacking play but could not help them get an unlikely winner. Went close with a long range free-kick but didn't have the impact Bilic was hoping. The manager probably won't be happy to have had to use him for what turned out to be over an hour.
Kouyate – 6.5
Really busted a gut to make a difference when coming on for Zarate and got up and down trying to make things happen. Did really well to create a chance from nothing down the right late on, but Lanzini failed to find the net from his pass. A key player, West Ham fans will be glad to see he is back fit after missing the City game.
Reid – 5
Came on for the last seven minutes and hardly touched the ball after his heroics at the Etihad on Saturday. Could only watch as Andy King scored a late, late winner. Question marks could be raised as to why Bilic changed the defence around so late in the day but it was a very deliberate attempt to hang on for penalties, which backfired.
SUBS NOT USED: Randolph, Oxford, Lee, Cullen.