Brentford went ahead after 20 minutes through Bryan Mbeumo before Jarrod Bowen looked to have rescued a point for West Ham with an 80th-minute equaliser.
But Brentford won it with the last kick of the game when Wissa scored a dramatic late winner.
It means Brentford move above West Ham and into seventh in the table as they continue their impressive start to life in the Premier League under Thomas Frank.
Substitute Wissa snatched it before Brentford at the death when Lukasz Fabianski punched away a header from a free kick and he hit a first-time shot through the crowd and into the net to stun West Ham and leapfrog the Hammers in the table.
Defeat for West Ham means they go into the international break in ninth place.