Bobby Zamora produced the first real shot of the game with his right foot; Jason Brown pushed it over the bar.
But a few moments later he once more found himself with the goal at his mercy after dropping his shoulder - and, again with his right foot, he drilled the ball home into the bottom corner.
Marlon Harewood then hit his first strike of the afternoon following a chest down of Matthew Etherington's cross by Sergei Rebrov.
He was on the score sheet soon after, sliding the ball in first time after a Zamora cross; Rufus Brevett had started the move on the left with a clever pass to Matthew Etherington.
Nigel Reo-Coker then tried to get in on the act after beating Nicky Southall in the tackle, but he drilled his effort wide.
The Gills had to replace Patrick Agyemang, who had a hamstring strain, around the half hour mark, and there was further woe for the visitors when Hayden Mullins popped up to head home at the far post after Bobby Zamora had fired a Matthew Etherington corner back across the goal mouth.
Just before half time, however, Byfield rose unmarked to head home a Chris Hope cross and give the away support some optimism for the second half.
Alan Pardew replaced Nigel Reo-Coker, who had had a cold in the week, with Carl Fletcher, who had also been ill recently.
He was immediately in the thick of the action, hitting a shot from outside the box wide, and Steve Lomas also tried to get in on the goal scoring act with a half volley that was saved.
But there was a scare for the Hammers when Danny Spiller crashed a shot against the post when a corner wasn't cleared and Andy Hessenthaler played a cross back in, and, following another corner, substitute Darius Henderson headed over.
Chris Cohen replaced Matthew Etherington on the left, while Luke Chadwick came on for Bobby Zamora, allowing Rebrov to move up front.
Marlon Harewood tried to make it four for West Ham with a rising shot from outside the box; Brown did well to parry over.
Gillingham were reduced to 10 men when Darren Byfield was stretchered off after colliding with advertising hoardings; by now, Malky Mackay, who was clearly struggling for fitness, was playing up front as Carl Fletcher covered for him at centre half.
Sergei Rebrov replaced Luke Chadwick in the starting line-up and, in the absence of the injured Teddy Sheringham, Chris Cohen went onto the bench.
TEAM: Bywater, Repka, Rebrov, Harewood, Lomas, Brevett, Mullins, Mackay, Reo-Coker [Fletcher], Zamora [Chadwick], Etherington [Cohen].
Subs unused: Walker, Ferdinand.