The Championship side were two goals down against their League One opponents, but Jermaine Johnson and Chris O'Grady - both former Oldham players - rescued them before Michail Antonio completed the win.
Oldham struck after seven minutes when a fine move down the right ended with James Wesolowski crossing to Jordan Slew, who marked his debut by slotting in from eight yards at the near post.
Wesolowski went close from long range before Oldham doubled their lead in the 26th minute as Lee Croft delivered a pinpoint right wing cross and Jean Yves Mvoto thudded home an eight-yard header.
Wednesday wasted a glorious chance just before half-time when Croft brought down Antonio on the left of the box and the resulting penalty was blazed over by Nejc Pecnik.
But after visiting keeper Chris Kirkland saved well from Croft, Wednesday pulled one back in the 53rd minute - Pecnik teeing up Johnson for an 18-yard shot which went through the dive of Alex Cisak.
The equaliser came eight minutes later as substitute O'Grady headed Miguel Llera's right-wing free-kick inside the far post from six yards.
And after 70 minutes Wednesday were in front when O'Grady produced a neat turn and shot from close range after Pecnik pulled back from the byline.
Antonio added the gloss three minutes from time, curling an effort powerfully into the far corner from just inside the box.
Westley endured a troubled time after taking over at Preston last season but saw his side make the perfect start to the new campaign when Jack King headed home after 29 minutes.
Nicky Wroe, a summer signing from Shrewsbury, then doubled the lead five minutes before the break to help the League One side into the next round.
Westley fielded a starting 11 which featured 10 summer signings, with only goalkeeper Thorsten Stuckmann surviving the close-season cull.
And the North End new boys enjoyed a dream start to the season when King's deft header floated past Alex Smithies in the Huddersfield goal after 29 minutes.
The striker, signed from Woking in the summer, directing Jeffrey Monakana's brilliant chipped ball inside the far post.
Wroe then side-footed Chris Beardsley's low cross into a gaping net five minutes before half-time to double the advantage.
Lee Novak would have pulled a goal back for the visitors after the restart had he not been slow to react to Paul Dixon's cross.
Seconds later Oscar Gobern's meek effort wasted some fluid build-up play as the npower Championship side failed to make a promising spell count.
A second half goal from Dexter Blackstock gave Nottingham Forest a 1-0 victory over Football League newcomers Fleetwood Town.
Blackstock earned his side a passage into the second round with the only goal of the game after 57 minutes.
The experienced Andy Reid produced a superb delivery from the left which was met by the unmarked striker at the far post.
His first header was well saved by Scott Davies but the rebound fell perfectly into his path and he stroked the ball into the empty net from close range.
A poor first half saw few efforts of any note. After 12 minutes debutant Jon Parkin forced Forest keeper Karl Darlow into a save low to his right after getting in behind his marker to head a Barry Nicholson free-kick low to the keeper's right.
Fleetwood continued on the front foot, with a Dean Howell cross just too high for David Ball, before the visitors produced their only shot on target in the first 45 minutes with a Greg Halford effort well blocked by Youl Mawene.
But Blackstock settled the tie just under an hour into proceedings when he beat Davies at the second attempt.
Forest went close to a second with Marcus Tudgay forcing Davies into two saves and Lewis McGugan flashing a shot just wide of the right post before Fleetwood staged a late rally.
Substitute Steven Gillespie drilled an effort just over with a minute to go and Darlow reacted well to save a last minute header from Stephen McNulty.