SAN FRANCISCO — Comebacks have been the norm for the Giants this season. The Brewers learned that firsthand.

Willy Adames drove in the go-ahead run in the bottom of the eighth inning against his former team to complete a three-run comeback as the Giants defeated the Brewers, 6-5, on Thursday afternoon at Oracle Park to take three of four games from Milwaukee.

“We feel confident that we have a really good team and that we’re going to make a comeback at any point,” said Adames. “That’s the mentality that we have. We don’t give up. We’re still resilient even though we’re losing by three, four. It doesn’t matter how many runs we’re losing (by). The whole team feels like we have an opportunity to win at some point.”

To Adames’ point, no team has been better at erasing deficits this season than the Giants.

Of San Francisco’s 17 wins, eight have come with them trailing by at least two runs, the most in all of baseball. Five of those wins — Thursday included — required them to overcome a deficit of at least three runs.

On Opening Day, Wilmer Flores hit a go-ahead, three-run, ninth-inning homer to stun the Cincinnati Reds. In New York, Jung Hoo Lee’s second homer off Carlos Rodón completed a three-run comeback. In Philadelphia, they responded to the Phillies’ three-run first with a six-run second en route to a blowout.

So, when San Francisco trailed Milwaukee, 5-2, entering the fifth, there was no sense that the game was over, even with the Giants playing a flat brand of baseball.

Landen Roupp, who struck out a career-high nine batters in his last outing, allowed five runs (four earned) over 3 2/3 innings. Catcher Sam Huff failed to block two balls in the dirt, leading to runs. First baseman LaMonte Wade Jr., now hitting .094, didn’t catch a throw from Matt Chapman, allowing a run to score. From the fifth onwards, the Giants looked like a different team.

Chapman brought the Giants within one run in the fifth by homering off Abner Uribe’s 100.4 mph sinker. Not only was it the fastest pitch that Chapman has ever homered against, but it was the fastest pitch that a Giants player has homered against in the pitch-tracking era (since 2008). Three innings later, San Francisco completed its comeback effort.

“For him, it was probably chill, but for the whole team, it was insane,” Adames said.

Tyler Fitzgerald led off the eighth by drawing a walk, then advanced to third on Wilmer Flores’ pinch-hit single. Two batters later, Fitzgerald scored the tying run on Mike Yastrzemski’s weak grounder despite Milwaukee playing its infield in, using his elite speed to beat the short throw home. That set the stage for Adames to play the hero against his former teammates.

With one out and Christian Koss on third base — Koss pinch-ran for Flores — all Adames needed to do was drive a ball to the outfield. On a 3-2 count, Adames hit a line drive at left fielder Christian Yelich, just deep enough for Koss to tag.

Koss positioned himself to sprint home. Adames’ screamer bounced off Yelich’s glove and onto the outfield grass. Koss scored without a throw, Adames was awarded a sacrifice fly, and the Giants had a 6-5 lead. And when the bullpen gates swung open for the ninth, it would be Camilo Doval — not Ryan Walker — who would be called upon for the save.

Doval’s afternoon was not without drama. The one-time All-Star opened up his day by walking Caleb Durbin on four pitches and throwing two balls to Brice Turang, an errant start that prompted Adames and Chapman to consult Doval on the mound.

“We went there just to calm him down, just to give him some time to breathe and … take it easy and get himself back together,” Adames said.

The consultation worked wonders. Doval induced three flyouts to record his second save in the last 24 hours and the Giants’ sixth series victory of the early season. At 17-9, they reside in second place in the stacked NL West, sandwiched between the first-place San Diego Padres (17-8) and third-place Los Angeles Dodgers (16-9).

Regarding his selection of Doval over Walker, manager Bob Melvin said he wanted to give Walker the day off following a second consecutive unsharp outing.

On Sunday, Walker allowed four runs, recorded no outs, and blew a save against the Angels. On Wednesday, Walker allowed two runs in the ninth inning and recorded one out, forcing Melvin to call upon Doval to finish the game. The Giants’ closer situation now appears a bit more ambiguous than a week ago, but Melvin said Walker will have the save opportunity on Friday if the game warrants it.