Smyly (6-8) struck out eight and walked two. The left-hander departed after Austin Dean reached on a fielding error to start the eighth.
"It's definitely nice to feel confident and be in sync with your mechanics and trust your stuff," Smyly said. "Not every team has this kind of support."
Gomes lofted a two-run shot to left center in the second to give the Cubs the lead for good. Hoerner had a two-run flare off Yunior Marte in the sixth to help end a two-game skid and send San Francisco to its fifth straight loss.
After Smyly left in the eighth, Manuel Rodríguez gave up Evan Longoria's bases-loaded ground rule double to kill a shutout bid. Brandon Hughes finished the inning and worked a clean ninth for his fourth save in eight chances.
Giants starter Carlos Rodón (12-8) struck out 11 in the 5 1/3 innings. He allowed three hits.
"That pitch, I would like back," Rodón said about the slider Gomes knocked out of the park after fouling off three pitches to stay in the box. "He battled and got the pitch count up there."
Giants catcher Austin Wynns left in the top of the sixth after being struck in the helmet by Smyly. The pitch caught the left earflap and spun the helmet off Wynns' head. After consulting with a trainer, the catcher walked to the dugout and was replaced by Joey Bart.
Manager Gabe Kapler said Wynns will be evaluated for concussion symptoms and won't start Saturday. The team plans to have an additional catcher in town should Wynns be unavailable to pinch hit or relieve Bart.
Rodón had his 10th double-digit strikeout performance, breaking the club record held by Jason Schmidt and Tim Lincecum. He fanned the last five batters he faced and has struck out at least 10 in four of his last five starts.
"It's a nice little milestone," Rodón said. "I'm just going to keep going and, hopefully, see how many we can get."
Giants: The club placed RHP Dominic Leone (elbow impingement) on the 15-day injured list before the game. Dean was promoted from Triple-A Sacramento to fill the roster spot and made his season debut in left field. ... Kapler said he might use a series of relievers in Sunday's series finale to fill the hole left by LHP Alex Wood's (shoulder) stay on the 15-day injury list.
Cubs: Second baseman Nick Madrigal left the game after the third with right groin tightness. Manager David Ross said Madrigal will be evaluated further tomorrow. ... OF Nelson Velázquez (illness) was scratched from the lineup a few hours before the start and replaced by Michael Hermosillo.