SANTA CLARA, Calif. — Sure, it was inevitable. Nobody loses them all in the NFL — if you discount the 2008 Detroit Lions. Still, that doesn’t mean there weren’t doubts from some of the players. Hey, you try going to work every day when the world is upside down.

And that doesn’t mean when the 49ers won for the first time since Kyle Shanahan became head coach — in their 10th game — they wouldn’t celebrate by dumping a bucket of water over on him, not Gatorade.

“We knew it was coming,” said Garrett Celek, the tight end who was very loose. “That’s the mentality of Kyle. He makes us believe.”

Then after a pause, a bit of self-reflection if not self-congratulations, Celek, who scored a touchdown on a 47-yard pass play in which he looked more like a ballerina than a receiver, compared a glorious recent pass with a disappointing present,at least until Sunday’s 31-21 victory over the New York Giants.

“I’ve been on teams (the 2012 Niners, his rookie season) that went to the Super Bowl,” said Celek. “It’s easy to work out then, easy to go every day. But when you haven’t won, it’s not so easy. But Kyle made us believe. That’s the culture he created.”

Although, as Shanahan conceded, the losses eat away at you. “Most people,” said the coach, “it’s a lot easier to check out, point fingers at people. That’s not what our guys did.”

Yes, just 1-9 (as compared to the awful Giants at 1-8), but success at last. Smiles at last. The way the Niners jogged off the field, players tossing chin straps and gloves to the remainder of a much-too-small Levi’s Stadium crowd (70,133 tickets sold; maybe 45,000 tickets used) it was if they had won a championship.

There was Jimmy Garoppolo, presumably the quarterback-to be, still not having played a down since being acquired from the Patriots, hurling his chin strap to a delighted fan. And there was C.J. Beathard, the quarterback of the last few weeks — and didn’t he play beautifully Sunday? — running to the locker room and the unknown.

The Niners have their bye next weekend. On ESPN, Adam Schefter said when they play their subsequent game, Garoppolo will be the starter. Not so fast, said Shanahan. “C.J.’s done a good job," the coach said. “He’s the same guy he’s been all season. Nothing’s too big for him.

“We haven’t made any decisions yet on our quarterbacks, so how could it be announced? We’re taking it week by week. We’ll continue working with Jimmy during bye week. We’ll have a bonus practice next Monday, then see where it goes from there. We’ll make our evaluation after that, Wednesday, Thursday, Friday.”

Beathard, a rookie who took over for Brian Hoyer a few games back, threw for 288 yards and two touchdowns and ran 11 yards for another touchdown. If this was his last game as a starter — for the immediate future, at least — it was a memorable one.

The Niners had lost five games in a row by three points or fewer. Then they were thumped. “Adversity,” said Shanahan. “It made us tougher. We got better through adversity.”

Now they have a victory. “Just one win,” said Shanahan. “We worked real hard for it. “

He was standing at the dais in the auditorium employed as a classroom for the players and at other times, such as this, media interview sessions. He was soaked and happy.

A season ago, as offensive coordinator for the Atlanta Falcons, he had gone to the Super Bowl. But now he was the head man. From now on, Kyle Shanahan would never lack a “W” beside his name.

“What people don’t realize,” said Shanahan, who is the son of former coach Mike Shanahan and grew up within the game, “is how hard it is to win in the NFL. The more you coach, the more you realize, whether it’s a good team or a not so good team ... five in a row by three points or less made us understand you can’t waste one play, can’t waste one day.

“Four hours on Sunday, but it starts on Wednesday.”

This was the first time in any of their six home games this season the Niners had a lead. “The biggest thing,” said Shanahan, "was how we did on third down. We had struggled not being able to play those third downs and stay on the field.”

In this game, this first winning game, they stayed. And stayed. They converted eight of the 12 third-down attempts, 67 percent. So two out of three times, the 49ers had their first down. And with Beathard connecting with Celek for the 47 yards, with Marquise Goodwin for 83 yards (“fastest man in the league,” Celek insisted) and with Matt Breida running 33 yards, they had what’s more important, touchdowns.

“We had some explosiveness this year,” Shanahan agreed. “We didn’t have explosive touchdowns. Then we got them.”