Headley wrapped up the National League's RBI title in what was the 2,430th and last game of baseball's regular season.
San Diego fell behind by six runs through three innings and then came back to avoid finishing the season on what would have been a four-game losing streak. Milwaukee finished four games above the .500 mark and missed the playoffs by four games.
The Padres began their comeback in the fourth on a solo homer by Chris Denorfia, Headley had an RBI double during a two-run fifth and Cameron Maybin chipped in a two-run shot in the sixth that brought San Diego within one.
Headley tied it in the seventh with his triple that delivered Will Venable and then scored on a sacrifice fly from Yonder Alonso.
Headley finished the season with 115 RBI, three more than Milwaukee's Ryan Braun. He became the second member of the Padres to lead the league in that category.
Tommy Layne (2-0) got the win with 1 1/3 innings of relief. Six members of the San Diego bull pen combined to throw 6 1/3 scoreless innings.
Jim Henderson (1-3) was charged with the loss, having given up the two seventh-inning runs.
Dennis Rodman pledges to end trips to North Korea
Jessica Simpson shares three-way kiss with friends in photo