The winners of the Hammers' Emirates FA Cup replay against Shrewsbury Town will travel to AFC Bournemouth or Wigan Athletic in the fourth round.
Monday night's draw pitted either the Hammers or the Shrews against the winners of another replay, after the Cherries drew 2-2 at home to League One promotion chasers Wigan.
Bournemouth needed a last-gasp leveller from Steve Cook to earn their replay after the Latics had at one stage led 2-0 thanks to Will Grigg and an own goal by Emerson Hyndman.
Eddie Howe's men came back, and like the Hammers they will have a second opportunity to make progress.
The fourth round ties will be played on the weekend of 26-29 January. Full ticketing and fixture details for the Hammers' third round replay will be confirmed shortly.