Fernando Torres scored twice to help Liverpool overcome battling West Ham.
Zavon Hines hit the post before Torres poked in the opener, but Alessandro Diamanti scored a debatable penalty that he appeared to touch twice.
Dirk Kuyt stabbed in Steven Gerrard's header and West Ham fought back with Carlton Cole nodding in Mark Noble's corner just before the interval.
With the Hammers tiring in the second half, Ryan Babel burst forward to chip in for Torres to head the winner.
The Hammers, looking for their first win since the opening day of the season, started off brightly and came within a whisker of taking the lead within only two minutes.
The Jamaican-born Hines, making his second Premier League start, stole possession from the napping Carragher on the edge of the box but could only curl his shot against the upright.
It was a wake-up call for the visitors and Yossi Benayoun, facing his former club, dinked his way into the box but shot only tamely into the grateful arms of goalkeeper Robert Green.
The Reds though, adopting a 4-2-3-1 formation with Torres as the solo striker, poured forward and grabbed the opener on 20 minutes thanks to a dash of Spanish magic.
The packed West Ham midfield, always pretty but often careless, handed the ball to Emiliano Insua and his through-ball found Torres on the left who weaved around James Tomkins before blasting over the on-rushing Green.
Manager Gianfranco Zola, recently celebrating his one-year anniversary at Upton Park, looked bemused on the sidelines, and his cause was not helped after 25 minutes, seeing Matthew Upson and a tearful Valon Behrami limping off.
Within three minutes of the enforced substitutes they were amazingly level after a sloppy challenge by Carragher on the dangerman Hines down the left-hand side of the box.
Up stepped Italian Diamanti for the spot-kick and although the ball flew over Pepe Reina, the Liverpool bench were incensed, claiming the striker had kicked the ball twice after slipping.
Back came Liverpool and they grabbed the lead again with Kuyt's boot getting on the end of a towering Gerrard header from an inswinging Benayoun corner.
For all of Liverpool's possession, West Ham's frontline was always threatening and stunned the visitors on the stroke of half-time when Cole outjumped three defenders to nod in the equaliser.
The second period was a case of West Ham hanging on with a handful of players suffering from cramp and their substitute options severely limited.
Benayoun twice went on dazzling runs and only last-ditch sliding tackles denied the Israeli midfielder from scoring wonderful goals.
Even the legs of the battling Diamanti proved too weary for the final onslaught as he was taken off to a standing ovation, replaced by former England star Kieron Dyer.
It was a flood of players in white desperate to break down the resolute Hammers defence, and with 15 minutes remaining they bagged the all-important strike.
Johnson, another player up against his former employers, stormed down the right wing and with Babel picking up possession, the Dutchman delicately chipped over to Torres who headed down brilliantly to regain the lead.
Still the hosts were not finished as they managed one last throw of the dice with Radoslav Kovac denied at the end by Reina's outstretched hand.
"We showed character and the team has confidence. Four wins in a row means that the team is in good shape.
"It was a very competitive game, they were working very hard too, but we gave them hope. It was difficult, but we did enough to win."
West Ham boss Gianfranco Zola on his players:
"I think they gave everything, I couldn't ask any more. It was a close game, but when you play against good teams like them it is difficult.
"The difference was that in the second half we got tired and they took advantage. We are used to fighting against problems, so it's no problem - we will be positive."