The centre-back timed his first goal for the club to perfection to secure a hard-earned victory in an all-action encounter against the Hammers in the Elite Group.
Up for a corner, Gallifuoco adjusted his body shape well to meet Christian Ceballos' driven cross and glance a looping header into the top corner in the 69th minute.
Jonathan Obika and Harry Kane - a belter from 22 yards - were also on target as we led three times, only to be pegged back to 1-1 and 2-2 before Gallifuoco's winner.
Kane was back in the line-up after returning from his loan spell at Norwich City and he was the outstanding performer of the first half.
Dean Parrett and West Ham's Elliot Lee traded shots just off target before Kane made his first impact on 26 minutes. He initially rifled in a shot that Jake Larkins did well to parry away down to his right and as play continued, Kane picked up the ball on the left, drove past Callum Driver to the byline and cut the ball back for Obika to slot home from six yards.
West Ham levelled on 41 minutes, Matthias Fanimo released Lee who drilled across Jonathan Miles into the far corner.
Kane showed his class again to restore our advantage just before the break. Picking the ball up 30 yards from goal, he worked a yard of space and let fly from 25 yards, an unstoppable shot that arrowed into the top corner.
West Ham responded well in the second half. Lee was unlucky to see a shot cannon back off the inside of the post and he was soon the provider for the second equaliser, cutting the ball back from the left for Wellington Paulista to finish.
Paulista went close again but play was soon back at the other end as Gallifuoco headed home what turned out to be the winner.
The nature of the game meant there were still more chances at both ends. Kane and Ceballos fired just wide, Miles made a fine save from George Moncur, Obika was denied one-on-one by Larkins and Lee lobbed West Ham's final chance over Miles but onto the roof of the net.
Spurs U21s (4-3-3): Miles; Fredericks (Byrne, 36), Gallifuoco, Veljkovic, Fryers; Luongo, Parrett, Carroll; Ceballos, Kane, Obika. Unused subs: Stewart, Priestley, Bostock.
West Ham (4-2-3-1): Larkins; Driver, Spence, Mpanzu, Shaw; Nasha (Bywater, 79), Moncur; Fanimo, Lletget, Lee; Paulista. Unused subs: Howes, Miles, Onariase, Mavila.