Coghlan, winner of the National League rookie of the year award in 2009, hit his first homer of the season after being called up while Emilio Bonifacio spends time on the disabled list.
The big inning gave the Marlins a 6-3 lead and they held on for the victory despite San Francisco's 14-hit attack.
San Francisco starter Tim Lincecum (2-5) remained winless in month May, giving up four hits, a walk and a sacrifice fly in the sixth.
Reliever Dan Jennings (1-0) picked up the first win of his major league career after being recalled from the minors this week. He worked a perfect top of the sixth with one strikeout after starter Josh Johnson had allowed three runs on nine hits.
Johnson left with his team trailing 3-2.
Miami took a three-run lead into the ninth, but had to sweat out the victory when Heath Bell gave up two runs. Steve Cishek came on to strike out Melky Cabrera to end the game with a runner on second.
It was Cishek's first save of the season and the fourth of his career.
Man behind Doritos Locos Tacos passed away on Thanksgiving
Exploding whale video goes viral on Internet