Christian Eriksen's set-piece was hijacked by the fan, who drew a save from Hammers goalkeeper Adrian before being led away by stewards
Christian Eriksen was lining up a free-kick in the 63rd minute but the Denmark international was stopped in his tracks as the pitch invader ran towards the ball and clipped an effort towards goal.
Despite being pursued by a steward, the fan was able to get his effort on target and draw a save from Adrian, while Eriksen's subsequent effort flew over the crossbar.
West Ham were unable to capitalise on their numerical advantage and their efforts weren't helped by James Collins' dismissal after the defender brought down Emmanuel Adebayor.
Eric Dier, a summer arrival from Sporting, netted the winner in the 90th minute for Mauricio Pochettino's side.