Pablo Sandoval saved his home run for the postgame news conference.

“I didn’t get the result that I wanted,” Sandoval said after bouncing to shortstop. “But I got the best result: the love from the fans.”

For Sandoval, the fact he put wood on ball after not seeing a pitch for more than three weeks was enough. Hell, it was more than enough — “at least I didn’t strike out” — in an at-bat that had little to do with baseball.

Sandoval, due for Tommy John surgery this week in Los Angeles, has been in significant pain for the better part of a month. Still, a San Francisco cult hero wanted to say goodbye and thank you to the fans, needed one more moment with Bruce Bochy, could not go under the knife and into an uncertain future without the city to stop for him one more time.

Sandoval will be a free agent at season’s close. He also will be a 33-year-old coming off serious surgery with nearly 1,300 games worth of tread on his Panda tires. Will he play another game for the Giants? In the majors?

“I had to do it before I get surgery because these fans, [their] support gave me a lot of love, a lot of passion,” an emotional Sandoval said after the Giants lost, 8-4, to the Padres at Oracle Park on Sunday. “I want to give you guys something before I get surgery.”

He drew 38,701 for a Sept. 1 game that meant little for a team out of the playoff picture. As soon as the familiar ball of energy emerged from the dugout in the seventh inning with his helmet on, the crowd got on its feet. Sandoval, whose family was on hand, took a second before stepping into the box.

“Everything,” Sandoval said, teary-eyed, when asked what was going through his mind. “I wanted to cry in that moment, but I held onto it. It’s great. It’s great when you feel the love from your fans.”

There was Luis Perdomo trying to get another out. There was Sandoval wagging his bat, as if his elbow weren’t about to undergo one of the more dreaded surgeries in baseball. It looked like yet another Sandoval at-bat with Bochy watching from the dugout, which belied what was going on in the Panda’s head.

“It was like my call-up in 2008,” Sandoval said about his nerve level.

He returned to the dugout and there was his manager of nine years, who just began his final month of coaching in the major leagues.

“It’s been a joy,” Bochy said.