Goals from Eddie Johnson and Peter Lowry put the hosts in control after the opening 30 minutes, but Albion regrouped at half-time and looked a different team after the break.
James Morrison should have started the comeback on 63 minutes, only to fail from the penalty spot, but he atoned three minutes later with a precise finish past Jake Gleeson.
Somen Tchoyi then latched onto a chip from Ishmael Miller before beating Gleeson with a dipping strike, and the game looked to be drifting to a draw until Tamas struck in added time.
The Romanian picked up a loose ball fully 30 yards from goal and unleashed a stunning shot that Gleeson could only tip into the top corner.
"It was such a magnificent strike," said Baggies boss Roy Hodgson afterwards. "A shot like that deserves to win any game.
"It was a strike that you see once in a blue moon. This was a blue moon day for us."