The Marlins were trailing 1-0 entering their final at-bat after being blanked over eight innings by Mets starter Jeremy Hefner, but pinch-hitter Chris Coghlan reached him for a lead-off single.
He went to second on catcher Anthony Recker's passed ball and gained third base on a controversial call.
On the play, Pierre's sacrifice bunt was fielded by Recker, who tried to nail Coghlan with a throw to third. It appeared Coghlan slid past the bag and was tagged out by the Mets' David Wright, but umpire Tim McClelland ruled him safe.
Lyon came in to pitch and Donovan Solano greeted him with a game-tying single, sending Pierre to third.
Lyon then uncorked a wild pitch, sending Pierre home as the Marlins won a third straight game for the first time this season.
Ryan Webb (1-1) earned the decision with a scoreless top of the ninth after Miami starter Kevin Slowey had yielded one run on four hits over eight frames.
Hefner (0-1) absorbed the loss despite surrendering just one earned run on four hits over eight full innings. The right-hander didn't issue a walk and fanned eight.
Notable deaths of 2014 [PHOTOS]