Jussi Jokinen, Sergei Zubov and Mike Modano failed to score in the shootout for the Stars before Nagy beat Anaheim goaltender Ilya Bryzgalov.
Stars goaltender Marty Turco stopped Corey Perry in the fourth round to give Dallas the victory after Anaheim's first three shooters - Andy McDonald, Ryan Getzlaf and Teemu Selanne - were unable to convert.
With a point for the overtime loss, the first-place Ducks eliminated the Stars from title contention in the Pacific Division.
Anaheim improved to 108 points, two better than second-place San Jose and three ahead of Dallas.
All three teams have one game remaining.
Selanne had given the Ducks a 1-0 lead late in the second period with his 46th goal.
Dallas tied it with 6.1 seconds left in regulation on Brenden Morrow's 15th goal. Morrow set up in front of the net and converted Nagy's centring pass out of the right corner. The goal was upheld after a video review.