Michael Keane rifled home to open the scoring and, seconds after Matthias Fanimo's well-struck equaliser, a third wonderful strike by Andreas Pereira was enough to earn the points and ensure Warren Joyce's side leapfrog the Hammers in the table.
Despite lacking an orthodox striker due to James Wilson's absence through illness, the Reds looked a threat from the outset with Joe Rothwell having a shot blocked. Pereira drifted a free-kick off target and Davide Petrucci worked Raphael Spiegel, following a beautiful piece of skill, before Elliot Lee headed wide for the visitors.
The match burst into life when Guillermo Varela and Saidy Janko were involved in the build-up that led to Keane receiving the ball inside the box. The centre-back twisted superbly to find enough space to bury a low drive his twin brother, striker Will, would have been proud of.
Jesse Lingard forced a save out of Spiegel but the Londoners levelled four minutes before the break when Kyle Knoyle's cross was touched back by Lee for Fanimo to unleash an unstoppable left-footed drive past Ben Amos.
The Reds' response was immediate and emphatic. Straight from the restart, Lingard's run was halted but Pereira bent a stunning finish into the net from the edge of the box, a mere 46 seconds after the equaliser. Only the bar denied Rothwell a third before half time after another positive run and cross by Janko.
Pereira and Reece James, who fired well over from a decent shooting opportunity, had efforts but the second period was understandably a little more subdued after the pulsating end to the first