Five minutes after CJ Sapong equalized for Nashville, Toronto had an opportunity to respond on a free kick attempt. Yeferson Soteldo's kick sailed towards Nashville's back post, and Gonzalez broke past the line on the set piece play and got the touch for the deciding goal.
It was Gonzalez's second goal of the season, with both scores coming against Nashville SC (10-3-11, 41 points). That first goal also came off a Soteldo free kick on August 1, when the two teams played to a 1-1 draw.
Jacob Shaffelburg gave Toronto FC (4-15-6, 18 points) the early lead with a strike in the 24th minute.
The victory ended both Toronto's nine-game (0-7-2) winless drought and the team's second six-game losing stretch of the season.
Nashville SC entered the game on a five-game (4-0-1) unbeaten streak but ended up suffering just their third loss of the season. Despite the big gap in the standings between second-place Nashville and last-place Toronto, the two sides were an even 1-1-1 in three meetings this season.
Sapong's goal was his 10th of the season, tying Hany Mukhtar for the team lead. Sapong was playing in the 300th regular-season game of his MLS career.
Sapong almost scored earlier in the game, but his close-range attempt was stopped by a nice save from goalkeeper Alex Bono in the 59th minute. That chance was part of an attacking flurry from Nashville, as Walker Zimmerman banked a header off the crossbar two minutes later.
Shaffelburg's goal was set up by a long pass from Auro at midfield. Goalkeeper Joe Willis came out of his net to cut Shaffelburg off, but the midfielder made a nice move to evade Willis and then deposit the shot.
It was the second goal of the season for Shaffelburg, who was making his fifth start of the season. Shaffelburg got the opportunity in the starting 11 as regulars Alejandro Pozuelo and Tsubasa Endoh were sidelined by injury.