Parker peach lifts Hammers off bottom
In the day's other game Manchester City were held 1-1 at home by Fulham as former City manager Mark Hughes enjoyed a satisfying return to his former club.
Scott Parker was again West Ham's inspiration, defying a shoulder injury to deliver a great performance and score the opening goal.
"Scott Parker was a big doubt. We didn't know if he could play," West Ham manager Avram Grant told the BBC. "He came and said he wanted to play and I don't know many players would have done so with his type of injury."
West Ham went ahead after 22 minutes with a superb goal by Parker, the England midfielder playing a one-two with Thomas Hitzlsperger before placing a shot beyond Pepe Reina.
They doubled their lead at the end of the first half when Demba Ba headed in a Gary O'Neil cross.
Liverpool struggled to get control and though they pulled one back through Glen Johnson after 86 minutes West Ham had the final say when Carlton Cole blasted home in stoppage time.
The victory took West Ham to 28 points and above Wigan Athletic and West Bromwich Albion and behind Wolverhampton Wanderers only on goal difference. It completed a good week for the Londoners after they thrashed Burnley 5-1 on Monday to reach the quarter-finals of the FA Cup.
Liverpool remain sixth on 39 points, six behind fifth-place Chelsea.
Manchester United, who beat Wigan Athletic 4-0 on Saturday, lead the standings on 60 points, four clear of Arsenal, who were playing Birmingham City in the League Cup final on Sunday.
Manchester City remain third on 50 points, three ahead of Tottenham Hotpur, after failing to beat a battling Fulham side.
City led with a powerful shot by Mario Balotelli after 26 minutes but did little else to impose themselves.
Fulham levelled three minutes into the second half when Andy Johnson crossed low for Damien Duff to finish.