Bumgarner allowed two runs on five hits over 7 1-3 innings. He walked one and struck out a career-high 14.
Gregor Blanco beat out a swinging bunt with two outs in the fifth, allowing Matt Duffy to score and Panik followed with a run-scoring double, putting the Giants ahead.
Alonso walked and Will Middlebrooks doubled to open the eighth. After Bumgarner struck out Clint Barmes, Will Venable doubled in two runs.
Odrisamr Despaigne cruised through the first four innings and was seemingly out of the fifth but could not cleanly handle Blanco's slow roller in front of the plate.
He had given up one run in his previous 29 1/3 innings against the Giants. Despaigne allowed two runs on five hits. He walked two and struck out two. Duffy, who doubled leading off, was the first runner to advance past first base.
Sergio Romo left the game after getting two outs in the top of the ninth with an apparent upper body injury.
Padres manager Pat Murphy earned his first career ejection, from home plate umpire Fieldin Culbreth, for arguing balls and strikes in the eighth. Matt Kemp was also ejected.
In all the years he spent coaching at Arizona State, Murphy never once watched a game at AT&T Park, until Tuesday night. He took his son on a tour of Alcatraz Island during Monday's off day and then took a walk around the stadium before the series opener. "I got to meet Hunter Pence," he said. "That was special. I love the way he plays." Murphy coached Giants hitting coach Hensley "Bam Bam" Muelens when both were with the 2000 Netherlands team that qualified for the Seoul Olympics. Muelens celebrated his 48th birthday Tuesday.
Padres: Right-hander Brandon Morrow (right shoulder inflammation) is close to throwing a bullpen or two, which would lead to a simulated game and a possible rehab assignment. "It doesn't look too far off," Murphy said. ... Left-hander Cory Luebke (Tommy John surgery) threw an inning with Double-A San Antonio, giving up a two-run homer. He walked two and struck out two.
Giants: Right-handers Matt Cain (flexor tendon strain) and Jake Peavy (back strain) will each get one more rehab start and will most likely rejoin the Giants on their road trip to Miami and Washington. ... Outfielder Nori Aoki was scratched from the lineup with a lower leg ailment.
Padres: Ian Kennedy (4-5, 5.43) is 2-0 over his last four starts following a four-game losing streak. He's lowered his ERA from 7.15 with a 2.63 ERA during his winning streak. He's faced the Giants twice this season, allowing one run over 9 1-3 innings.
Giants: Ryan Vogelsong (5-5, 4.38) is coming off one of his best starts of the season, a three-hitter over 6 2-3 innings in a 7-0 win at Seattle. He struck out a season-high six. He's still 1-3 over his past four starts, having allowed 12 earned runs over the three losses, a span of 16 1-3 innings