Liverpool proved they could win without talismanic striker Luis Suarez as they fought from behind to take three points from Upton Park.
- Related Content
Uruguay international Suarez was serving a one-match ban but the Reds struck twice late in the game to seal a win that sees them leapfrog West Ham in the table.
Former Hammers' defender Glen Johnson opened the scoring for the visitors with a tremendous effort before a Mark Noble penalty and Steven Gerrard own goal turned the game in West Ham's favour before the break.
It was another West Ham academy graduate in substitute Joe Cole who pulled the visitors level in the second half with a James Collins own goal completing the comeback for Liverpool.
Gerrard, returning to captain the visitors after recovering from illness, saw an early effort deflected behind for a corner following some good work by Jonjo Shelvey.
West Ham then had a few minutes of dominance and Mohamed Diame, a one-time Liverpool target, saw his shot deflect off the back of team-mate Carlton Cole and drift just wide of Jose Reina's goal.
West Ham's Matt Jarvis was getting a lot of the ball down the left flank but was soon found wanting when he was tested defensively.
Gerrard played the ball out to Johnson on the touchline and the England full-back cut inside Jarvis with ease before arrowing a strike past the out-stretched hand of Jussi Jaaskelainen.
Johnson did not celebrate out of respect for his former club but the Liverpool bench was up in unison as the visitors grabbed an early lead.
Raheem Sterling had two chances to double Liverpool's advantage, firstly firing wide of Jaaskelainen's near post as Gerrard's shot was cleared straight to his feet.
Moments later Johnson again got the beating of former Wolves winger Jarvis and rolled the ball into Sterling's path, but the 18-year-old's low drive was just off target.
West Ham started to get more into the game after 25 minutes and again began testing the Liverpool defence with a number of high balls into the area, with their equaliser duly coming nine minutes before the interval.
A West Ham set-piece was cleared as far as Guy Demel whose shot hit the arm of Joe Allen as the former Swansea man closed him down.
Referee Lee Probert deemed the block to be intentional and pointed to the spot, with Noble stepping up to coolly convert the penalty.
Matthew Taylor, recalled to the starting line-up by Sam Allardyce after making an impact as a substitute against Chelsea last weekend, then headed high and wide from close range as West Ham started to take control.
The spell of pressure yielded a second goal for Allardyce's side, albeit it in fortunate circumstances.
Liverpool switched off after conceding a free-kick which Noble took quickly and found Jarvis in space on the left.
The 26-year-old produced yet another fantastic delivery into the box and the ball was sent flying past Reina off the head of Gerrard.
Shelvey then had a good opportunity to level on the stroke of half-time when he was picked out by Stewart Downing but his shot was well wide.
The second half started with both sides looking to be more creative in possession although neither Reina nor Jaaskelainen was tested before the hour-mark.
Sterling came close to levelling as his left-foot effort from the edge of the penalty area forced Jaaskelainen to flick the ball over his bar for a corner.
Shelvey had worked hard in an unfamiliar attacking role all afternoon and saw a header flash wide with 20 minutes remaining before Rodgers introduced Jordan Henderson in place of the ineffectual Lucas.
A serious looking leg injury suffered by Diame made Allardyce's afternoon even worse, with the in-form midfielder replaced by James Tomkins after pulling up hurt.
Joe Cole had been introduced by Liverpool before the game was 30 minutes old and was warmly received by the home fans.
The former Chelsea playmaker has struggled during his time with Liverpool and had little impact on the game until he struck a venomous equaliser after being played in by Sterling and, like Johnson, he refused to celebrate the goal.
The turnaround was completed just 12 minutes from time as Henderson swung in a low cross that Shelvey and Collins competed for with the balling looping up off the boot of the West Ham defender and over a helpless Jaaskelainen.
Sterling almost burst through to wrap up the game for the visitors, who saw out the five minutes of stoppage time to creep into the top half of the table.