An intense 2-0 win over Sevilla in midweek that secured passage to the UEFA Champions League quarter-finals did appear to impact their laboured second-half performance, but a sprightly start and dogged defending towards the end were ultimately crucial as Leicester clinched their first away league win of the season.
They picked up right where they left off in midweek with a remarkable start to go two goals up within seven minutes – Riyad Mahrez and Robert Huth stunning the hosts.
West Ham soon got themselves a lifeline through a fine Manuel Lanzini free-kick, though Leicester re-established a two-goal lead late in the first half through Jamie Vardy.
But West Ham responded once more as they pulled another one back just after the hour mark - Andre Ayew nodding in from close range as the home side looked to ensure a tense ending for Leicester.
Kasper Schmeichel was at his very best to make a vital late save, while an awful Ayew miss let Leicester off the hook and saw the match slip away from West Ham.
Any suggestions of Leicester weariness after their Champions League exploits were swiftly put to bed during a ferocious start.
There was a hint of fortune about their fifth-minute opener, as Mahrez cut in from the right and saw his left-footed cross sail all the way into the bottom-left corner.
But there was nothing fortuitous about their second just three minutes later.
Marc Albrighton nudged a short free-kick to Mahrez, before receiving it back courtesy of a disguised pass from the Algeria star that took West Ham by surprise, and the former Aston Villa midfielder's brilliant lofted ball with the outside of his right foot picked out Huth for an easy headed finish.
West Ham's situation was made even worse by Winston Reid's forced withdrawal with a suspected thigh problem in the 18th minute.
They pulled one back a few moments later, though, Lanzini finding the top-left corner from an exquisite 20-yard free-kick.
But their joy was short-lived, as Vardy smashed home from close range after Mahrez's corner fell kindly to him just before the break.
Leicester reverted to the counter-attacking setup that served them so well last season when they came back out for the second half.
And it almost brought about a fourth goal just before the hour - Shinji Okazaki pouncing on a loose ball before feeding Vardy through on goal, only for the England striker to slice wide under pressure from Darren Randolph.
West Ham then made the most of that let-off, as Ayew steered in from close range after Andy Carroll headed a Lanzini cross back into the danger zone.
Carroll was involved again 14 minutes from time, forcing Schmeichel into a marvellous save down to his left after a bullet header.
Ayew was then guilty of a terrible miss as he blazed over when one-on-one with Schmeichel, before Cheikhou Kouyate's effort from six yards out amid a goalmouth scramble was kept out by a combination of Leicester defenders.
Schmeichel came to the rescue again in stoppage-time, rushing out to deny Carroll from point-blank range as the desperate champions just about held on to a hard-fought win to move six points clear of the relegation zone.
Key Opta stats:
- Craig Shakespeare is the first manager in Premier League history to have his side score three-plus goals in his first three games in the competition.
- West Ham are without a win in four Premier League home games (D1 L3) for the first time since January 2014.
- Riyad Mahrez has scored as many PL goals in three games under Craig Shakespeare, as he had in his final 22 under Claudio Ranieri.
- Marc Albrighton has had a hand in three goals in his last four appearances for Leicester in all competitions, as many as in his previous 27.
- Jamie Vardy scored and assisted in a league game for the first time since March 2015 (v Tottenham Hotspur).
- Andre Ayew has been directly involved in a goal in four consecutive league games for the first time ever in Europe's big five leagues (3 goals, 1 assist).