Phoenix held a big lead and seemed to be cruising to victory when the Bucks mounted a furious comeback, overcoming a 21-point deficit.
But Nash's key basket assured the Suns' third straight win.
He finished the game with 18 points and 11 assists. Marcin Gortat added 21 points and nine rebounds for Phoenix.
Milwaukee got 25 points from Drew Gooden, but it wasn't enough to prevent the Bucks' third consecutive defeat.
Ersan Ilyasova provided 17 and 12 rebounds for the losers.