London - Diafra Sakho's header saw West Ham beat Bristol City 1-0 on Sunday as they avoided becoming the latest Premier League side to be knocked out by lower league opposition on a sensational weekend of FA Cup action.
However, the Hammers left it late at City's Ashton Gate ground, with Sakho only scoring nine minutes from time after Andy Carroll's cross hit the underside of the bar.
Bristol City were looking to follow in the footsteps of fellow third-tier side Bradford, who produced one of the all-time great FA Cup shocks when they knocked out Premier League leaders Chelsea 4-2 at Stamford Bridge on Saturday.
City's Matt Smith twice had headers from corners cleared off the line in the opening period, the first by Mark Noble and the second when the striker's opposite number, Carroll, headed the ball away from beneath his own bar.
However, West Ham turned round at half-time with the match still goalless and then saw England winger Stewart Downing go close to breaking the deadlock on the hour mark when he shot just over the top.
But it was Senegal striker Sakho, who ensured east London side West Ham, FA Cup winners in 1964, 1975 and 1980 and losing finalists as recently as 2006, would take their place in Monday's fifth-round draw, although Smith went close again in stoppage-time.
Championship high-flyers Middlesbrough won 2-0 away to Premier League champions Manchester City on Saturday and Sunday's remaining Cup ties saw two more second-tier clubs looking to make it into the last 16 at the expense of top-flight sides.
Bournemouth, the Championship leaders, were away to Aston Villa while Arsenal travelled to Brighton.
With Chelsea, Manchester City and Southampton - defeated 3-2 by top-flight rivals Crystal Palace on Saturday - all beaten, none of the Premier League's top three remained in the FA Cup.
Swansea and Tottenham also failed to make it into Monday's fifth-round draw.
Meanwhile Manchester United, fourth in the Premier League, face a replay against fourth division Cambridge after a goalless draw on Friday.
The same scoreline also saw Liverpool held by Championship club Bolton at Anfield on Saturday.