Paul Anderson lost his first game in charge of Huddersfield Giants as Wakefield Trinity Wildcats scored five second-half tries.
Huddersfield led 8-6 at the break with two tries from winger Luke George.
Eorl Crabtree extended their lead to 12-6 just after the break but the Wildcats hit back with tries from Dean Collis, Lee Smith and Richie Mathers.
Tim Smith and Danny Kirmond crossed over late on to stretch their lead and end a run of four straight defeats.
Anderson took over the Giants on Monday after Nathan Brown, who will take over at St Helens at the end of the season, agreed to leave the club early.
The former Great Britain forward handed the captaincy to Luke Robinson and recalled five players after their heavy Challenge Cup defeat by Warrington last weekend.
Greg Eden was a late inclusion after winger Aaron Murphy pulled out through injury after the warm-up.
George opened the scoring for the Giants on 16 minutes after Scott Grix seized on a dropped pass by scrum-half Tim Smith.
Ben Cockayne replied after picking up a grubber kick from Smith but George put the Giants back into the lead with his second try of the afternoon after a pass by Leroy Cudjoe.
Once Crabtree had run over on 47 minutes, the floodgates opened as Warrington scored 29 unanswered points in the second half.
Collis got the ball rolling after the Giants defence failed to clear a kick from Danny Brough, while Lee Smith ran in his first try for the Wildcats.
Ali Lauitiiti fed Mathers to make it 20-14 and Tim Smith and Kirmond scored in the last 10 minutes.
Paul Sykes scored a late drop-goal to add to his five goals.
The Giants have now won just one of their last nine games in all competitions.
VIEWS FROM THE DRESSING ROOM
Huddersfield Giants coach Paul Anderson:
"We managed to get ourselves 14-6 up but without really playing. We let ourselves down in a lot of areas and failed to keep control of the ball.
"We had a lot of field position early in the first half and didn't do anything with it. We tried to be too sideways and didn't build any pressure.
"We were too lateral, we were like a pair of windscreen wipers. We tried to go around them and to their credit, they defended well."
Wakefield Trinity Wildcats coach Richard Agar:
"The big message at half-time was to hang on to the ball. It was a really strong wind in the first half.
"We defended a lot of what they had to throw at us and I felt we handled their kicking game.
"We defended really well in the second half. I can't remember our line being under threat too much and was really pleased with our half-backs."
Huddersfield: Grix, George, Cudjoe, Gilmour, Murphy, Brough, Robinson, Crabtree, Moore, Mason, Ferguson, Fairbank, Eden.
Replacements: Fa'alogo, Patrick, Lee, Cording.
Wakefield: Mathers, Fox, Collis, L. Smith, Cockayne, Sykes, T. Smith, Amor, Ellis, Raleigh, Lauitiiti, Kirmond, Washbrook.
Replacements: Wood, Wilkes, Johnson, Trout.
Referee: Tim Roby (RFL)