Ramirez walked to open the 12th off Josh Spence (0-1), the eighth San Diego pitcher of the night. After a strikeout Infante sent a drive off the wall in the left-center field that allowed Ramirez to score standing up.
Infante's hit, his third of the game, was the Marlins' first since Infante's single in a run in the seventh that put Miami up 8-7.
Steve Cishek (4-0) came on in in the 10th and pitched three innings of one-hit relief in collecting the win.
The Marlins scored five times in the first with Ramirez hitting a three-run home run and Giancarlo Stanton adding a two-run homer off Padres starter Anthony Bass. San Diego countered with six runs in the third inning with Bass capping the rally with a bases-loaded triple.
Miami tied the score 6-6 when Jose Reyes score on a balk but Bass scored on a Mark Kotsay base hit in the fifth. The Marlins then took the 8-7 lead in the seventh on RBI singles from Greg Dobbs and Infante.
Wisconsin business offering 'therapeutic cuddling' forced to close
Costly malfunction causes beer flood at Boston-area brewery