The visitors had twice fallen behind at Craven Cottage to an own goal from Kolo Toure and Kieran Richardson's close-range strike, but Daniel Sturridge and Philippe Coutinho restored parity before Gerrard kept his cool from 12 yards in injury time.
Fulham took the lead in fortuitous circumstances when Toure hacked Richardson's cross into his own goal, but Sturridge levelled shortly before half-time by applying an expert finish to become the first Liverpool player to score in seven consecutive Premier League games.
Liverpool dominated the second half but fell behind to Richardson's strike shortly after the hour mark, yet Coutinho silenced the home fans on 72 minutes with a curled strike from 20 yards.
And the visiting fans were sent into pandemonium in the closing stages when Sturridge was brought down by Sascha Riether in the penalty area, with Gerrard duly dispatching the penalty.
The result leaves Liverpool four points adrift of table-toppers Chelsea, while Fulham remain bottom.
The hosts belied their league position in the opening stages and their positive start was rewarded in bizarre circumstances eight minutes in. The impressive Lewis Holtby played a superb throughball to Richardson and his first-time pass was sliced into his own goal by Toure.
After a slow start, Liverpool began to get a foothold in the game and Luis Suarez drew a smart near-post stop from Maarten Stekelenburg.
Fulham were defending resolutely, but the hosts' resistance was finally broken four minutes before half-time.
Sturridge sprung the offside trap to latch onto Gerrard's sublime first-time pass with the outside of his boot and the England international striker kept his composure to apply the finish via the post.
The leveller seemed to reinvigorate Liverpool, who saw Sturridge and then Gerrard go close with long-range strikes before the break.
Liverpool started the second half brightly but the visitors were almost caught cold from Steve Sidwell's audacious chip from the halfway line that Simon Mignolet managed to collect.
The away side poured forward in search of a goal and Suarez's low drive from the edge of the box beat the goalkeeper but rebounded off the post.
Fulham made Liverpool pay for that miss by taking the lead for a second time on 63 minutes. Martin Skrtel inadvertently deflected Sidwell's cross into the path of Richardson, who fired home from close range.
The lead lasted just nine minutes, however, as Coutinho cut in from the right before angling a 20-yard drive into the far corner with his left foot.
And there was still time for one last twist as Riether felled Sturridge in the area in the 90th minute, and Gerrard fired into the left-hand corner to secure all three points.
Get the best features, fun and footballing frolics straight to your inbox every week.