Justin Miller (3-2) earned the win by getting the final two outs in the eighth inning, and Kevin Gregg earned his 21st save by pitching a perfect ninth.
Bobby Howry (3-4) entered in the ninth and took the loss, after Hermida's home run on a 3-2 pitch. Geovany Soto and Reed Johnson hit solo homers for the Cubs, who fell to 3-5 since the All-Star break.
Chicago's Jeff Samardzija, the former Notre Dame football star, made his major league debut after being called up from Triple-A Iowa before the game.
Samardzija came in to protect a 2-1 lead in the seventh, but couldn't hold it.
With two outs, Jorge Cantu doubled in Hanley Ramirez to tie the score, but Samardzija avoided any further damage by getting Mike Jacobs to pop up to second baseman Mike Fontenot.
His second inning went smoother, as he retired the side in order. He ended up allowing one run and two hits with two strikeouts in two innings.
Samardzija received a standing ovation - his first of many - when he took the mound, and the crowd cheered when he struck out pinch-hitter Alfredo Amezaga to lead off the seventh.
While he showed some wildness - badly missing Soto on a pitch out - he also displayed a fastball that was clocked at 99 mph on the stadium radar gun.
Cubs starter Ryan Dempster tired during a hot day at Wrigley.
Dempster opened the second inning by hitting Dan Uggla, who had been hitless in his previous 13 at-bats. Josh Willingham made Dempster pay by doubling to right-center field to score Uggla.
Dempster allowed two hits and struck out six, but walked a season-high six in six innings. In the fifth, Dempster got the first two men out before walking the bases loaded. He then struck out Uggla to get out of the jam.