Paul Sykes sent Widnes crashing to their first defeat in four matches as his last-gasp try handed Wakefield victory at the Stobart Stadium.
Sykes swept over with the last play of the match to settle a rousing contest with Jarrod Sammut landing the conversion.
Widnes switched Jack Owens to full-back in the absence of injured Rhys Hanbury with Declan Hulme called up on the wing and he notched two tries. Centre Stefan Marsh also returned after a shoulder injury.
The Wildcats took the lead with a stunning try after Widnes should have gone in front but Macgraff Leuluai opted not to pass to Jon Clarke.
When Kevin Brown threw out a loose pass on the Wakefield line, Sammut swooped on the ball to sprint 80 metres before sending Chris Riley over.
Sammut tagged on the conversion to make it 6-0 after seven minutes.
After 19 minutes, Richard Moore charged through two defenders to increase the lead to 12-0 with his first try since returning from Leeds.
But Widnes finally broke the Wildcats defence with Brown and Marsh combining for Hulme to cross in the corner with Danny Tickle’s conversion attempt going over off the post.
Widnes turned up the heat before the break with Tickle held over the line before Brown’s long pass put Paddy Flynn over, Tickle adding the touchline conversion.
Sammut booted the restart dead to give Tickle a penalty chance from the half-way line but the ex-Wigan and Hull forward was just wide with the long range effort to leave it 12-12 at half-time.
Hulme struck again two minutes after the restart after collecting Danny Craven’s neat kick to plunge over with Tickle kicking the conversion.
Wakefield refused to lie down and were back on level terms with Harry Siejka plunging over and Sammut adding the goal to make it 18-18.
Paul McShane was held up close to the Vikings line, with Sykes missing a drop goal attempt for Wakefield after 73 minutes.
Tickle then missed a penalty and drop-goal for Widnes before Pita Godinet was short with a one-point effort. Then up popped Sykes with his match-winning effort.
Widnes Vikings: Owens, Flynn, Dean, Marsh, Hulme, Brown, Craven, Johnson, Clarke, Gerrard, Allen, Tickle, Leuluai. Substitutes: Isa, Kavanagh, White, Clough.
Wakefield Trinity Wildcats: Sammut, Mathers, Ryan, Walshaw, Riley, Sykes, Siejka, Anderson, McShane, Scruton, Kirmond, Washbrook, Smith. Substitutes: Godinet, Moore, Molloy, Fairbank.
Referee: B Thaler (RFL).