Juan Perez's two-out, tiebreaking RBI single capped a two-run uprising in the eighth inning that erased a one-run deficit and lifted the Giants to a 5-4 victory over the Padres, whose seven-game winning streak dissolved.