The Hammers had seen Stoke City relegated earlier in the day, but they took a huge stride towards their own safety courtesy of goals from Joao Mario and Mark Noble - the latter of whom sealed his side's first ever win at the King Power Stadium with a goal of the season contender.
Leicester, meanwhile, are now winless in their last six home matches as the pressure on manager Claude Puel continues to grow, with the Foxes missing the chance to guarantee a top-half finish with two games to spare.
West Ham started the brightest against an injury-plagued Leicester side, with Manuel Lanzini creating an opening as early as the sixth minute when his shot was blocked by Yohan Benalouane before Pablo Zabaleta's cutback from the rebound went through to safety.
Leicester goalkeeper Ben Hamer was then fortunate to get away with a mistake which almost gifted Marko Arnautovic a simple goal, but West Ham were soon back on the front foot again and this time Lanzini's low goalbound drive struck Arnautovic before going wide.
The visitors were getting most of their joy down the left flank, and that avenue almost provided the opener moments later when Arthur Masuaku's cross found an unmarked Zabaleta, only for the full-back to plant his header wide of the near post.
West Ham's own intensity dipped as the half wore on, but they upped the tempo again shortly after the half-hour mark with Lanzini sliding the ball down the channel for Arnautovic, who was thwarted by Hamer with the angle against him.
There was growing unrest amongst the home fans at their tepid and toothless display, and Leicester were left thanking the woodwork in the 33rd minute when Arnautovic was quickest to react to a flick-on before unleashing a vicious half-volley which crashed against the bar with Hamer beaten.
A deserved opener did arrive just one minute later, though, with Arnautovic turning provider when he knocked Masuaku's cross back into the path of Mario, who was left with a simple finish from close range.
The goal saw West Ham net in an 11th consecutive top-flight away game for the first time since December 1966, but Leicester responded to the setback with their first meaningful shot of the match when Fousseni Diabate worked space outside the area, only to drag his effort wide of the target.
It was a rare foray forward from the home side, though, and they were soon on the back foot again when Lanzini burst past Wes Morgan inside the area before slamming his finish into the side-netting from a tight angle.
There was one final half-chance for Leicester before half time when Riyad Mahrez broke in behind the defence, but Jamie Vardy failed to get a clean connection on his subsequent pass and the home fans sent their team into the break with boos ringing in their ears.
Puel's side responded to that vocal criticism by coming out of the blocks much quicker at the start of the second half, and Aaron Cresswell was fortunate to stay on the field when he purposefully handled the ball after stumbling as the last man with Vardy in hot pursuit.
Clear chances were still difficult to come by for the Foxes, though, and it wasn't until past the hour mark that they really threatened Adrian's goal, with Harry Maguire lashing a thunderous volley narrowly over the crossbar from the edge of the area.
However, West Ham gave themselves a two-goal cushion in some style moments later when Noble drilled a stunning first-time volley into the bottom corner from 25 yards out, leaving Hamer no chance with his crisp and technically-perfect strike.
Arnautovic was a nuisance all match and almost got his own name on the scoresheet with just under 20 minutes remaining when he danced his way into the area, only to see his eventual shot take a deflection on its way over the top.
It took until the 86th minute for Leicester to finally register their first shot on target of the match as Adrien Silva's strike was comfortably held by Adrian, although that did signal the start of a late rally from the hosts.
Adrian was forced into two further saves to deny a couple of Benalouane headers, but it was too little too late and did nothing to appease the home fans who booed their side off the pitch.
The result sees Leicester extend their winless run to five matches and fail to score in three consecutive games for the first time since January 2016 going into their final two outings against North London duo Tottenham Hotspur and Arsenal.
West Ham, meanwhile, move to within two points of the 40-point mark ahead of their final matches against Manchester United and Everton, although Moyes will be hopeful that his side have already done enough to stay up without needing wins from the home games against two of his former clubs.
LEICESTER (4-4-1-1): Hamer; Benalouane, Morgan, Maguire, Fuchs; Mahrez, Choudhury (Iheanacho 61'), Iborra (Dragovic 46'), Diabate (Gray 61'); Silva; Vardy
WEST HAM (3-4-3): Adrian; Rice, Ogbonna, Cresswell; Zabaleta, Kouyate, Noble, Masuaku (Evra 93'); Mario, Arnautovic (Fernandes 79'), Lanzini (Carroll 75')