The Marlins ended a seven-game losing streak, getting an eight-strikeout performance over eight innings from starter Mark Buehrle.
Josh Lindlom (3-4) came on to work the bottom of the ninth and he wound up retiring only one of the four batters he faced.
Petersen opened the inning with a double and remained on second base when Jose Reyes grounded out to third. Giancarlo Stanton was then walked intentionally, bringing up Lee.
Lee drove a 1-0 pitch into left field to deliver the winning run.
Buehrle allowed only an eighth-inning run and did not walk a batter while throwing 115 pitches, but he left with the score tied and did not figure in the decision.
The win went to Steve Cishek (5-2), who struck out two in the top of the ninth. The other Miami run came on a homer in the fourth by Giancarlo Stanton, his 35th of the season.
2014: NFL Cheerleaders [PHOTOS]
LeBron James reveals his new Nike shoes