Headley, who came off the 15-day disabled list before the game, connected on a 2-2 fastball from Carlos Marmol (0-3) to cap a four-run sixth inning and give the Padres a 6-2 lead.
San Diego, which came in averaging a major league-low 2.8 runs per game, was coming off its highest scoring output since Sept. 25, a 10-1 win over Miami on Friday.
Smith hit a solo homer, a two-run double and an RBI triple for the Padres, who matched Friday night's total of 13 hits.
Casey McGehee hit a two-run homer in the first inning for the Marlins, whose road record dropped to 3-12, worst in the majors.
With the score tied at 2, Marmol relieved Nathan Eovaldi in the sixth and got two quick outs. But Everth Cabrera reached on an infield bunt, stole second and went to third on catcher Jarrod Saltalamacchia's throwing error.
Marmol intentionally walked Smith, who had an RBI triple in the first and hit a solo homer in the third. Jedd Gyorko followed with an RBI single.
Headley, who was hitless in two at-bats with a walk when he pulled Marmol's 93 mph fastball down the right field line. The ball went just inside the foul pole for his third homer.
Eric Stults (2-3) allowed two runs on six hits over six innings.
The switch-hitting Headley came into the game batting just .186 with two home runs and seven RBIs in 70 at-bats. He was one of four San Diego regulars hitting below .200.
Smith has been one of the few Padres who has consistently hit this season. Since May 3, the lefty is batting .577 (15 for 26) with six doubles, three triples, a home run and six RBIs.
NOTES: The Padres have scored just 10 runs while Stults was in the game in his eight starts. . The Marlins came into the game with an 8-2 record against left-handed starters, tops in the majors. . Padres RHP Hector Ambriz, designated for assignment on Thursday, cleared waivers and was outrighted to Triple-A El Paso on Saturday. . Marlins RHP Henderson Alvarez (2-2, 2.62 ERA) faces Padres LHP Robbie Erlin (1-4, 4.95) in Sunday's finale.