Luis Suarez and Jon Flanagan won penalties either side of a controversial Guy Demel equalizer to keep the pressure on Manchester City and Chelsea in the title race.
Referee Anthony Taylor found himself at the center of the action at Upton Park from the moment he penalized James Tomkins for handball late in the first half, allowing Gerrard to notch his first goal two minutes before the break.
But West Ham went into the locker room level through Guy Demel's first goal for the club, which came after Simon Mignolet had dropped a corner under pressure of highly questionable legality from ex-Liverpool striker Andy Carroll. Amid understandable protests from the visitors, referee Taylor signalled for the goal, and he did so again following lengthy consultation with his assistant.
Carroll headed against the crossbar after the hour before West Ham's Adrian became the second goalkeeper to fall foul of Taylor, who adjudged him to have impeded Jon Flanagan for Gerrard's second penalty in the 71st minute.
Luis Suarez curled a first-time effort against the frame of the goal late, but Liverpool had already done enough to maintain their quest for the Premier League crown.
Brendan Rodgers' side returns to the top of the table, two points above Chelsea and four ahead of Manchester City - who have played two games less and head to Anfield for what looks set to be a season-defining encounter in seven days' time.
Napoli loanee Pablo Armero made his full debut for West Ham after left back George McCartney suffered a hamstring strain in Monday's 2-1 win at Sunderland.
A knee injury suffered in training by Daniel Agger meant a change for Liverpool at center back - Mamadou Sakho starting for the first time since they last lost in the league, at Chelsea on December 29.
Suarez had been the central figure in the subsequent 11 wins and two league draws, and the forward glanced the top of the netting with an early free kick but couldn't score in the contest, being denied late by both the crossbar and Adrian, as Liverpool closed out the kind of gritty win upon which title triumphs are often built.