West Ham needed Craig Dawson's first goal for the club seven minutes from time to beat non-league Stockport 1-0 and reach the FA Cup fourth round on Monday.
Hazardous conditions under torrential rain helped the National League side bravely hold out against the Hammers, who are just three points off the top four of the Premier League.
David Moyes named a strong side containing seven internationals, but the fireworks off the pitch that momentarily halted play outdid the action on it in the first-half.
Michail Antonio and Said Benrahma were guilty of missing big chances as the visitors cranked the pressure up in the second-half.
West Ham were finally rewarded when Dawson met Jarrod Bowen's cross with a powerful header to set up a fourth-round meeting with Doncaster.