The brilliant strike from the edge of the box was just what Cardiff deserved after a big claim for a penalty went against them. Referee David Webb ruled that Jason Davidson's sliding foul on Stuart O'Keefe started outside the box.
Mr Webb gave the free-kick instead of a penalty and Whittingham unleashed a beauty into the top corner. That goal, 11 minutes from time, was Whittingham's second of the game.
Lex Immers also scored on his debut while Town's goals came from Nahki Wells and Harry Bunn.
Wells had an early sight of goal but fired wide after good work by Bunn. Whittingham replied immediately afterwards for Cardiff but his free-kick was met by Sammy Ameobi whose header dropped wide.
Just past the half hour, Town almost unlocked the Bluebirds back line when Kyle Dempsey whipped in a cross and Matthew Connolly was alert again to snuff out the chance as Wells hovered. From the resulting corner, Dempsey lashed wide.
Cardiff went ahead in the 37th minute when Ameobi worked the ball down the right for Anthony Pilkington. The former Huddersfield forward brilliantly pulled the ball back from the byline and found Whittingham who fired home low past Jed Steer.
Town were level within three minutes with Wells' clinical finish. Jamie Paterson provided the cross and Wells took advantage of Karim Matmour's decoy run to collect and fire left-footed into the bottom corner.
Straight from the restart Wells and another chance but Bruno Ecuele Manga blocked him out.
Midfielder Immers, on loan from Feyenoord, put Cardiff back in front in the 61st minute after finishing off a great team move.
Ameobi and Fabio Da Silva started the move before Ameobi was put through on goal on the right. Instead of shooting he looked up and picked out Immers, one of several unmarked at the far post, who slotted home.
In the 74th minute Wells forced a close-range save from David Marshall, smashing his shot into the ground, and two minutes later Joe Ralls' 25-yard drive was tipped onto the bar by Steer.
Huddersfield had calls for a penalty for handball turned down before Davidson's escape in the 79th minute.
Whittingham made it 3-1 with his 79th-minute sizzling free-kick only for Huddersfield to grab a stoppage-time consolation when Wells put Bunn through one-on-one. The striker made no mistake, smashing into the top corner, but it was too late to mount a rescue.