A late extra-time winner ensured the Foxes continued their unbeaten run in all competitions to make it through to the last 16 of the League Cup.
West Ham have beaten Arsenal, Liverpool and Manchester City on the road this season but failed to beat a resilient Leicester side at the King Power Stadium.
Claudio Ranieri made ten changes to the team that started at the weekend at Stoke with only Gokhan Inler retaining his place in the line-up.
After scoring a hat-trick on his debut in the previous round at Bury, 20-year-old Joe Dodoo put the Foxes ahead on his home debut after just six minutes with a fine finish.
The visitors had a large amount of possession throughout the match and their spell of pressure earned a reward when Mauro Zarate’s deflected effort was too much for Mark Schwarzer to keep out.
It was an enthralling game between West Ham and Leicester who are 3rd and 4th in the Premier League table respectively.
There was a great amount of attacking intent shown in a match that Ranieri and Slaven Bilic were doing everything to try and win the game; an encouraging sign in a competition that isn’t treated with the necessary respect by the big teams.
A positive for West Ham is goalkeeper Adrian who had an excellent game, making countless saves and stopping Andrej Kramaric, Jeffrey Schlupp and Riyad Mahrez in one-on-one situations.
N’Golo Kante once again made the difference when he came onto the pitch sparking new energy into the midfield; his passing, tackling and interceptions were a real boost for Leicester.
City should have put the game away much earlier but it was Andy King who popped up in the 116th-minute to head home the winner after a fantastic cross from Christian Fuchs.
Ranieri was really getting the crowd going after the goal to show what the support means to him and his players.
Leicester will find out who they face in the next round in the draw after the last eight matches of this round have been played on Wednesday night.