Craig Dawson spared West Ham's blushes as they progressed to the FA Cup fourth round with a 1-0 victory over non-league Stockport at a sodden Edgeley Park.
The driving rain left the pitch resembling a mud bath at full-time and largely negated the gulf in class between the sides, with Stockport having a couple of half-chances to claim one of the round's biggest upsets.
But the Premier League side, 86 places above their Vanarama National League opponents, avoided a giant-killing as Dawson headed home from Jarrod Bowen's right-wing cross seven minutes from time.
David Moyes had made five changes to his line-up from the Premier League win at Everton on New Year's Day, with with Ben Johnson, Mark Noble, Andriy Yarmolenko, Manuel Lanzini and Michail Antonio all drafted in.
But it was still a line-up comprising of seven internationals against a side who had reached this stage of the competition for the first time since 2007, and with Wayne Rooney's younger brother, John, in their ranks.
They showed plenty of resolve, especially at the back to snuff out several Hammers forays, but their attentions will now turn to a return to the Football League.
The hosts were largely camped in their own half early on and almost fell behind when Said Benrahma chested down a cross, shimmied to find an opening before shooting against the outside of the post.
A fireworks display at one end of the stadium brightened up a gloomy night but the deafening noise brought the game to a brief halt, and thereafter the visitors lacked a spark despite creating several opportunities.
Yarmolenko let fly from distance but missed the target, while West Ham were given a scare when goalkeeper Darren Randolph's punch from a corner flew behind him, only for one of his own defenders to bail him out.
The tricky conditions were encapsulated when Ben Hinchliffe spilled a routine shot from Lanzini, although the Stockport goalkeeper gratefully gathered at the second attempt with no West Ham player able to follow-up.
Lanzini's effort from the edge of the box was the only one of West Ham's seven attempts that were on-target in the opening 45 minutes, although Antonio twice failed to make the most of being put through.
On the first occasion, Antonio was unable to cleanly collect Yarmolenko's precision ball down the middle and was then denied by Mark Kitching's superb last-gasp challenge as he shaped to shoot following Lanzini's pinpoint pass.
The pitch was becoming increasingly unpredictable, with the ball routinely stopping in surface water, which was proving something of a leveller for Stockport, who were more of an attacking force after the interval.
After Connor Jennings saw his shot hacked clear, Richie Bennett was introduced in place of the subdued Alex Reid and nearly made an impact, dispossessing last-man Dawson, only for a wayward pass to end the opportunity.
At the other end Benrahma fluffed an attempt from a narrow angle after Hinchliffe slipped while attempting to clear, while the Stockport custodian missed an attempted punch before using his feet to clear.
By this stage West Ham were on the front foot, and a short corner was worked to Bowen, whose cross from the right was glanced into the net by Dawson as the deadlock was finally broken in the 83rd minute.
Stockport offered little to suggest extra-time might be on the cards as West Ham comfortably held on to set up a fourth-round tie against Doncaster.