West Ham manager Sam Allardyce's tactical switch at half-time paid off as the Hammers rallied from 1-0 down to defeat Chelsea 3-1 at Upton Park.