With Chelsea's win over Stoke on Saturday moving the Blues to the summit, Brendan Rodgers' side reacted to the pressure with an unconvincing win - the type teams with title-winning aspiration are nevertheless all too happy for at this stage.
Gerrard struck from the spot in either half, with Guy Demel drawing West Ham level in first-half stoppage time.
Now Liverpool can prepare for an Anfield clash with trophy rivals Manchester City next Sunday, knowing another win would bring a first league title for 24 years even closer.
The Reds' return to top spot seemed to be going smoothly as Gerrard's first penalty put them ahead late in the first half, but the hosts hit back almost immediately with a controversial Demel leveller after former Liverpool striker Andy Carroll appeared to foul Simon Mignolet in the build-up.
The visitors' second penalty was another contentious decision, with referee Anthony Taylor deciding Jon Flanagan had been fouled by Adrian, but Gerrard thrashed the spot-kick home to wrap up a ninth consecutive win for Liverpool.
The Premier League's leading goalscorer Luis Suarez could not add to his tally but hit the woodwork twice, with Carroll also kept at bay by the crossbar with a strong header after the interval.
Suarez sent out a warning shot inside the opening three minutes as he bent a 30-yard free-kick just over the top of Adrian's crossbar.
He went closer still with his next effort as he clipped a shot over the West Ham goalkeeper, only to see the ball come back into play off the woodwork.
All of Liverpool's threat was coming courtesy of 29-goal man Suarez as he looked to whip the ball past Adrian from another opening, with James Tomkins bravely heading the shot behind.
Unlike his strike partner, Daniel Sturridge had been shackled well in the opening 30 minutes and could only balloon a chance high over the crossbar as the ball dropped to him.
The England man faired little better after Tomkins fluffed his lines as he tried to clear the ball, arrowing a shot wide of Adrian's goal.
With just a minute remaining of the first half Suarez was released by a sumptuous Gerrard pass and, as the Uruguayan looked to cut inside, the ball hit the arm of Tomkins, with referee Taylor pointing to the spot.
Gerrard stepped up confidently to send Adrian the wrong way and put the visitors ahead.
But West Ham did not let their heads drop and levelled in controversial circumstances on the stroke of half-time.
Mark Noble's corner was aimed towards Carroll, whose hand caught Mignolet in the face as the goalkeeper looked to take possession, with Demel on hand to turn the ball in.
Taylor gave the goal after a long consultation with assistant referee Stuart Burt and was in deep discussion with Rodgers as the teams disappeared down the tunnel at half-time.
The Hammers started the second half under pressure but managed to soak up anything Liverpool could throw at them before the hour-mark before creating the best chance to take the lead.
Demel and Diame combined down the right before the latter swung in a cross which was attacked from deep by Carroll, whose header cracked off the crossbar with Mignolet well beaten.
Sturridge burst past Matt Taylor and Winston Reid as the half went on but once again his direction was slightly askew and he failed to test Adrian.
West Ham skipper Kevin Nolan was replaced by Antonio Nocerino with a little over 20 minutes remaining having struggled with a back injury throughout the week.
Moments later Liverpool were rewarded a second penalty as Adrian was adjudged to have brought down Flanagan, despite getting a hand to the ball before bundling into the full-back.
Gerrard again made no mistake from 12 yards, scoring a pair of penalties for the second time this season and putting the visitors back in front at Upton Park.
Sturridge finally managed to find the target with 10 minutes remaining as he fired in a dipping volley which was too close to Adrian to cause the Spaniard any real trouble.
Suarez once again hit the crossbar, this time with a swerving lob, and was denied by the feet of Adrian late on, with Sterling also forcing a smart save from the West Ham goalkeeper in injury time.
Liverpool then saw out the remaining four minutes of added time without incident to return to the top of the Premier League pile.