Diafra Sakho's second-half header was enough for West Ham to progress in the FA Cup at Bristol City's expense.
The League One club were the better side in the first period and had two efforts cleared off the line.
West Ham struggled to make chances, but good work from Andy Carroll set up Sakho to nod in at the far post.
West Ham forward Mauro Zarate has completed his loan move to QPR for the rest of the season.
The 27-year-old Argentine will go straight into contention for QPR's Barclays Premier League trip to Burnley on Saturday.
Rangers boss Harry Redknapp is expected to continue to seek another loan recruit to bolster his frontline in the January window, despite recruiting Zarate.
Returning midfielder Joe Cole said he will never forget cleaning the toilet floors ahead of his first West Ham debut - and intends to make the most of a second chance at Upton Park.
The 31-year-old has come back to his boyhood club on a free transfer from Liverpool, and looks likely to go straight into the squad for the FA Cup third-round tie against Manchester United. Cole was among a crop of Premier League stars to emerge from West Ham's academy.
He signed professionally in 1998, and became a fans' favourite before leaving for Chelsea in 2003, the year in which the east London club were relegated from the Premier League.
The midfielder has been capped 56 times by England, and got his introduction to first-team football with the Hammers back in January 1999, in an FA Cup tie against Swansea at Upton Park. For more on football visit ITV Sport.