West Ham took the lead in the 45th minute in east London when Michail Antonio guided in Enner Valencia’s cross at the far post.
However, Liverpool drew level three minutes after half-time when Philippe Coutinho’s free-kick sneaked under the wall.
Neither side were able to find a winner before full-time – and Angelo Ogbonna’s late header secured the win for the home team late in the second half of extra-time.
Carragher was clearly frustrated by Liverpool’s defending during the game, and he used his personal Twitter account to express his views after the final whistle.
The former Liverpool defender tweeted:
Lfc didn't deserve that but you're asking for trouble conceding silly set pieces with their size & our poor record on set pieces.
— Jamie Carragher (@Carra23) February 9, 2016
West Ham will now travel to Blackburn Rovers in the fifth round on Sunday 21 February.
MORE: The latest football news