Huddersfield dominated possession for large parts of the match but were unable to break the deadlock and fell behind when Scott McDonald drilled home a 78th-minute effort to hand Boro the lead against the run of play.
But Lee came off the bench to score an equaliser from close-range eight minutes later, before his fellow substitute Ward - back in the squad for the first time since suffering a metatarsal injury before Christmas - had the last word with a left-footed strike from 25 yards.
Huddersfield were quick out of the blocks, Lee Novak sending the ball narrowly wide of the right post from the edge of the penalty area after just 20 seconds.
Former Town striker McDonald had Boro's first effort of the match as he fired a 25-yard strike wide of Alex Smithies' left-hand post.
Huddersfield's best chance of the opening 45 minutes came on the half-hour mark, as Oliver Norwood met a superb Paul Dixon cross with his head, only to send the ball just wide of the left-hand post.
Ishmael Miller and Grant Leadbitter both mustered long-range efforts for the visitors, before Town's Adam Clayton sent a low drive whistling past Jason Steele's left post from 25 yards.
Huddersfield were calling for a penalty on the stroke of half-time when Theo Robinson was caught by a high boot in the six-yard box, but the referee was unmoved and waved play on.
A mistake by Anthony Gerrard after 55 minutes allowed Middlesbrough to go on a rare attack, but McDonald's resulting effort was blocked by Jack Hunt.
McDonald gave Boro the lead against the run of play in the 78th minute as he sent a left-footed effort into the centre of the goal to deny Smithies a clean sheet on his 23rd birthday.
However, Lee came off the bench to replace Norwood and appeared to have rescued a point for the hosts with an 86th-minute strike from close range.
But Huddersfield were not finished yet, as the returning Ward fired a 25-yard strike into the back of the net in injury time to seal a deserved three points for the Terriers.