The Jets trailed 3-2 late in the third period before Ehlers tied it with 1:20 remaining after a scramble following a faceoff deep in the offensive zone. He then scored the winner with 1:01 with a shot from the right faceoff circle.
Ehlers also had an assist, while Andrew Copp had a goal and two assists.
Evgeny Svechnikov also scored, and Connor Hellebuyck made 32 saves for the Jets, who have won three straight.
Trevor Zegras and Sonny Milano had a goal and an assist, and Josh Manson also scored for Anaheim. John Gibson stopped 21 shots for the Ducks, who have dropped five of their last six.
Anaheim grabbed a 2-1 lead 1:39 into the third period when Manson ripped a wrist shot from near the blue line that deflected off Dubois' glove and into the net. Copp tied it less than four minutes later with a shot from the right faceoff circle off a pass from Stastny.
Zegras put Anaheim on top again with a snap shot after Milano stole the puck deep in the Winnipeg zone, but the Ducks were unable to sustain momentum.
Svechnikov opened the scoring at 2:07 of the second period when he took the feed in the slot from Pierre-Luc Dubois and beat Gibson with a wrist shot that Gibson was unable to stop with his stick or blocker. It is Svechnikov's first goal with the Jets after he signed as a restricted free agent during the offseason.
The Ducks tied it four minutes later when Trevor Zegras stole the puck from Nate Schmidt in the offensive zone and passed it to Milano, who fired a wrist shot past Hellebuyck for his first goal of the season.
Anaheim's Troy Terry and Winnipeg's Dubois extended their points streak to five games. It is a career best for Terry, who had the second assist on Manson's goal. Terry has eight points (three goals, five assists) in his last five games. Dubois has had a five-game point streak for the third time in his career, with five goals and three assists.
Kyle Connor, who is tied for fourth in the league in scoring with 10 points (six goals, four assists), has a point in four straight games after getting the second assist on Svechnikov's goal.
Gibson made his 327th career appearance for the Ducks and surpassed Jonas Hiller for sole possession of third place among goaltenders in franchise history.
Jets: Continue their road trip against the Los Angeles Kings on Thursday.
Ducks: Host the Buffalo Sabres on Thursday.
More AP NHL: https://apnews.com/hub/NHL and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.