Hefner (4-7) finished the 2012 campaign by holding opponents to two runs over 14 1/3 frames in his final two starts. The right-hander allowed two runs on five hits while walking two and fanning seven.
Bobby Parnell earned his seventh save as the Mets snapped a four-game skid.
The Marlins' Tom Koehler (0-1) took the loss in his first major-league start, yielding three runs on six hits over five full frames.
Gorkys Hernandez got the only RBI for Miami, who lost 12 of its final 16 games of the season.