SAN FRANCISCO — It is impossible, with any certainty, to pinpoint precisely when a season ceases to justify hope. Fancy statistics and mathematics can go only so far. And even if such a feeling took residence in the clubhouse, it would be fiercely guarded from public view.

The only evidence, then, is what can be gleaned on the field. And what the Mets have consistently presented is an overwhelmingly bleak picture, one littered with dark smudges and stains, such as Thursday night’s 10-7 loss to the Giants.

The defeat was distinctive in its awful timing and unyielding torment, a postcard from a promising season gone so wrong. The pivotal moment, manager Terry Collins said, unfolded “before we could blink.”

Journeyman Justin Ruggiano hit a fourth-inning grand slam off Madison Bumgarner — one of the most improbable homers of the season — to give the Mets a 4-0 lead.

But it was merely a prelude to horror.

advertisement | advertise on newsday

The Giants responded with eight consecutive runs, sending Mets ace Jacob deGrom to one of the worst starts of his career and turning a highly anticipated pitchers’ duel into glorified batting practice.

“It seemed like everything I threw went right down the middle,” said deGrom (7-6, 2.73 ERA), who lasted only five innings on a night in which the Mets’ bullpen was short. “These guys did a great job. Tonight’s on me. I was terrible out there.”

DeGrom set career highs for hits (13) and runs allowed (eight), and the Mets absorbed another kick in the teeth. They dipped below the .500 mark (60-61) and slid 4 1⁄2 games back in the chase for the final wild card.

Mets pitching has allowed 38 runs in the last four games, and the news only worsened after the game when the Mets announced that Steven Matz will be scratched from his scheduled start on Friday night. He will be replaced by Seth Lugo.

The Giants’ 10-21 slump since the All-Star break has cost them first place in the NL West, but playing another team in a freefall was hardly an elixir for the Mets, who have lost 15 of their last 22 games.

Mets videos

“You’ve got to say to yourself, in the middle of the game, you’ve got a four-run lead with Jake deGrom,” Collins said. “Your chances of winning the game are good.”

Indeed, Ruggiano briefly allowed the Mets to believe that their fortunes might turn. Marooned with the Rangers’ Triple-A affiliate, he was released and signed with the Mets on July 30. He played three games, bungled a few fly balls and pulled his hamstring. But Ruggiano has had success against Bumgarner, which is why the Mets made sure his rehab assignment ended in time for the series opener against the Giants.

The move ultimately looked shrewd. In the fourth, Ruggiano appeared to strike out looking on a slider that buzzed the bottom of the strike zone, but plate umpire Brian Gorman did not move his hand, sending a wave of groans sweeping over AT&T Park. In the dugout, Giants skipper Bruce Bochy fumed. Replays confirmed: The Mets caught a break.

Two pitches later, they caught another. With the count full, Bumgarner (12-7, 2.25) left a slider over the plate, and Ruggiano drove it into the netting that protects the garden behind the centerfield fence.

“I took a long at-bat with him and finally got something I could hit,” Ruggiano said.

advertisement | advertise on newsday

The Mets led 4-0 behind their first grand slam since April — off the bat of a player who hadn’t homered in the big leagues since Sept. 29. And as an added bonus, the Mets handed the cushion over to deGrom, who had allowed two runs in his previous 30 2⁄3 innings. But the lead wouldn’t last through the inning.

Hunter Pence laced an RBI single, Eduardo Nuñez tripled home two more and Bumgarner added the twist of the knife. One of the best-hitting pitchers in baseball, he hit his third homer of the year for a 5-4 lead.

The Giants tacked on three runs in the fifth behind an RBI single by Nuñez and a two-run double by Joe Panik.

Ty Kelly laced a two-run triple in the sixth and scored on Rene Rivera’s groundout to make it 8-7, but it proved to be a tease. Buster Posey’s two-run double off the rightfield wall in the eighth extinguished hopes of a comeback.

By the end, all the Mets could do was cling to the hope that reinforcements haven’t come too late. Yoenis Cespedes and Asdrubal Cabrera are expected to be activated from the disabled list.

advertisement | advertise on newsday

“We’re getting healthier, you know?” Ruggiano said. “Trying to stay positive around here.”