Hermida, batting for catcher Paul Hoover to start the top of the ninth, slammed an offering from losing pitcher Bob Howry (3-4) into the right-field seats.
His 13th homer this season snapped a 2-2 tie.
Jason Willingham and Jorge Cantu also knocked in runs for the Marlins and Hanley Ramirez had two of the six hits for Florida, who stopped a two-game skid.
The winner was Justin Miller (3-2). Closer Kevin Gregg earned his 21st save.
Chicago catcher Geovany Soto and outfielder Reed Johnson launched solo homers in the second and fifth innings.
Johnson and Ryan Theriot had two hits apiece for the Cubs, whose home record fell to 38-13.
Florida starter Josh Johnson surrendered two earned runs and seven hits in 5 1/3 innings with three walks and eight strikeouts.
Cubs' starter Ryan Dempster yielded an earned run and two hits in six innings with six walks and six strikeouts.