Hammers midfielder Manuel Lanzini capitalised on a scramble in the box to tuck the ball home in the 34th minute of the knockout match.
The goal was then subject to a VAR check, with Peter Bankes the man responsible for ratifying the home side's lead from Stockley Park.
Nikola Vlašić was on track to pull the trigger after charging into the box before a well-timed challenge by debutant Leo Hjelde sprang the ball loose.
Under pressure from Jarrod Bowen, Illan Meslier couldn't gather up the ball and Lanzini reacted quickly to poke it in from six yards.
The VAR was tasked with determining whether Bowen was in an offside position when Vlašić took the shot, and whether he interfered with play.
Following a lengthy review, Bankes, assisted by Lee Betts, decided that the goal should stand, giving West Ham the lead in the third round tie.
But Leeds captain Liam Cooper, who is currently sidelined with a hamstring injury, was not happy with Bankes' ruling.
"Shambles," Cooper tweeted, accompanied with two angry face emojis.