SAN FRANCISCO — If the Giants are going to claw their way out of the massive hole they’ve dug for themselves, they’re going to need to win a lot of baseball games in a very short time. Recording a sweep on Thursday afternoon would’ve helped that cause.

Instead, San Francisco’s troublesome bullpen affirmed why it’s one of the worst in the game.

One out away from recording their first sweep of the season, the Giants instead endured a gut-wrenching 9-6 loss as a four-run lead devolved into a three-run defeat. This latest collapse, one in which five relievers allowed seven runs over three innings, serves as the latest example of the front office’s inability to reinforce a bullpen that needed reinforcements this winter.

“We gave up a touchdown in the last three innings,” manager Tony Vitello said. “You could certainly, if you want to play devil’s advocate, say there’s two sides to the whole thing. You could talk about some balls finding holes or a broken-bat hit and things like that. But the bottom line is we needed to do better.”

Caleb Kilian entered in the top of the ninth tasked with protecting a 6-5 lead and locking down the Giants’ (33-47) first sweep of the season. The A’s quickly put the tying run in scoring position as Henry Bolte singled and advanced to second on a wild pitch, but Kilian retired the next two batters and got the afternoon crowd to its feet.

Then, the avalanche.

After Tyler Soderstrom drew a walk, the A’s Jonah Heim snuck an opposite-field single past the outstretched dive of third baseman Matt Chapman. Bolte scored the tying run, and the A’s were off to the races.

Lawrence Butler followed Heim with an RBI single, giving the A’s a one-run lead, then Max Muncy delivered the backbreaker with a two-run bloop single that gave the green and gold a 9-6 lead. Kilian was pulled from the game after allowing four runs, but the damage had been done. While Kilian got dinged for the blown save, the disaster began two innings prior.

The Giants entered the top of the seventh leading 6-2, but the A’s chipped into their advantage by plating a pair of runs off Ryan Walker. Jeff McNeil then brought the Athletics within one run in the top of the eighth with an RBI single off Dylan Smith, reducing the Giants’ advantage to 6-5. In the ninth, the Athletics’ high-octane offense made up for being quiet on Tuesday and Wednesday.

“Again, if you’re going to play both sides of the coin, however you want to say it, the A’s have been held down well below their capabilities offensively. Eventually, they were going to get some hits. Unfortunately, it was against us today,” Vitello said.

Victor Bericoto, despite the loss, had another outstanding all-around game, recording another outfield assist and hitting another no-doubter. Coincidentally, Bericoto’s two-run homer had the same distance (445 feet) and exit velocity (108.7 mph) as his walk-off on Wednesday. The rookie became the Giant since Dusty Rhodes in 1953 to record both a home run and an outfield assist in back-to-back games.

Before Bericoto’s two-run blast in the sixth, right fielder Jung Hoo Lee continued making his case for his first All-Star appearance with a bases-clearing, two-out triple.

Landen Roupp made his first start at Oracle Park since the Pride Night controversy on June 12, when he wrote a Bible verse on the team’s special Pride caps. He received a smattering of boos during introductions, then Roupp turned in a second straight quality start, allowing two earned runs over six innings with six strikeouts to one walk.

Roupp helped his own cause by making a nifty play to turn two in the sixth, spearing a comebacker behind his back before firing to shortstop Willy Adames to kick-start a 1-6-3 double play. The right-hander also got an assist from Bericoto, who recorded his second outfield assist in the last two days by firing a 94.2 mph seed to second base to throw out Soderstrom.

Baer talks

Two days after president of baseball operations Buster Posey declined to field questions about the team’s Pride Night controversy, Giants president and CEO Larry Baer went on KNBR on Thursday morning and became the first prominent member of the organization to address the matter.

“I just wanted to say a couple of things to you and our fans and speak from the heart, really, as somebody who’s been involved with this ownership group from day one,” Baer said. “This ownership group has been really involved in supporting the LGBTQ community. It’s strong and unwavering for over 30 years now, really. … I know we’ve heard from many fans and I know their deep feelings about the events of Pride Night this year. We know it. We’ve heard. We’re listening.

“Just some context here, over those 30-plus years, it’s a north star here to create an experience at our ballpark for all fans … our park should be a place where everyone feels welcome, respected and valued. I just want to make that really clear. We take pride in being industry leaders in that effort with the LGBTQ community.”

Baer went on to reference the Giants’ involvement with the LGBTQ+ community over the last three decades. He noted that the Giants became the first professional sports team to host an HIV/AIDS awareness game. Baer also mentioned that the Giants are one of two teams, along with the Los Angeles Dodgers, that wear special Pride-themed caps during their Pride celebrations.

“Yes, we’ve learned a lot in the last 11 days. Yes, we could’ve handled things better this year, for sure. We’re absolutely committed to continuing our conversations with members of the LGBTQ+ community going forward. … I just wanted to deliver that message to the fans and move on and be able to — let’s talk about some other things. Last night and all.”