SANTA CLARA >> Marquise Goodwin’s ability to play through the sorrow of his son’s death earlier Sunday had 49ers coach Kyle Shanahan in awe a day later.

“For a guy to go through that, to have those whole emotions, to go the whole night before not really sleeping much, then come out there and have very pivotal plays in the game and make a huge difference, that says a lot about the guy,” Shanahan said Monday.

Goodwin went public after Sunday’s 31-21 win with his tragic news, sharing an Instagram picture of his son’s left hand grasping presumably one of his parent’s fingertips.

His wife, Morgan Goodwin, told People Magazine she was 19 weeks pregnant — “I was almost halfway there,” she said — before having to deliver the baby stillborn at 3:52 a.m. They named him Marquise Jr.

“I felt joy in holding my baby even though it was a sad moment,” Morgan told People. “I was so amazed. His eyes were still shut at this point, but the hands, the feet. He looked exactly like his daddy.”

Complications throughout the week led to her preterm labor. Shortly after Sunday’s game, Marquise’s posted on Instagram: “Although we are hurt, I am grateful for the experience and grateful that God blessed me with a wife as courageous and resilient as Morgan.”

Shanahan learned of the Goodwins’ ordeal Saturday morning and excused his starting wide receiver from team meetings. With the situation seemingly improving, Goodwin returned to the 49ers hotel, only to be summoned to his wife’s side and to the hospital.

Said Shanahan: “I know Marquise was hurting bad, real bad. And I know he will for a while, and I know his wife will, too.”

After being comforted by team chaplain Earl Smith on Sunday morning, Goodwin told Shanahan “he was adamant he wanted to play.”

Shanahan fought through emotions, too, while watching Goodwin. He was glad a deep pass hit Goodwin in stride and he was able to score his first touchdown of the season. Shanahan also was relieved that Goodwin wasn’t seriously hurt blocking on Celek’s score.

“He got the wind knocked out of him,” Shanahan said. “I thought he was hurt until I saw him smiling on the ground trying to breathe. It was pretty neat and I’m very happy for him. You could see the whole team was, too.”

Enough players knew about Goodwin’s ordeal that at least seven rushed to celebrate his touchdown, and Shanahan said he expected a delay-of-game penalty, which the 49ers barely avoided.

Added Shanahan: “He did a hell of a job for his wife, being there for her. He helped out his family from that aspect, and also helped out his (49ers) family here, too. He helped out every side and was pretty impressive.”

Shanahan, 37, may be a first-year head coach but he’s been involved in the NFL and seen players have to cope with deaths in the family, though it’s usually been for a parent.

A father of three, Shanahan said: “Everyone reacts differently to that stuff. So I don’t think you can judge or expect anything. I’ve had people who’ve had a death happen and they can’t see anyone, so they go home right away, and you totally understand and respect that. I’ve been around some people who that happens and they need to play the next day; they think that’s what someone would want and that’s important to them and helps them.”

Quarterback C.J. Beathard’s did not fracture the thumb on his right, throwing hand Sunday, said Shanahan, who hasn’t decided whether Beathard or Jimmy Garoppolo will start Nov. 26 against the Seattle Seahawks following this week’s bye.

“We’ll see how practice goes next week,” Shanahan said. “C.J. played pretty well and had his best game.”

Beathard won for the first time in four starts while completing 19-of-25 passes for 288 yards with two touchdown passes, as well as a rushing touchdown in which he aggravated his thumb injury.

“He’s gotten better each week in practice and he got to show it in the game,” Shanahan said. “Other guys around him played their best game, too. That makes it definitely easier to keep everybody out there and keep it going.”

• Quarterbacks coach Rich Scangarello and Shanahan will work with Garoppolo, who’s taken a crash course in the playbook two weeks since his arrival in a trade from New England.

“We’ll see how Jimmy responds this week, when we can work a little more one-on-one with him,” Shanahan said. “We’ll have a little extra practice Monday and see how it goes.”

• What made Adrian Colbert’s starting debut even more impressive is the fact he played all 66 snaps despite fracturing his thumb in the first quarter.

Colbert will require surgery and is questionable for the Nov. 26 game against Seattle, but he might be able to play a cast on his thumb, Shanahan said. He started at free safety in place of Jimmie Ward and Jaquiski Tartt, who are on IR with forearm fractures. Antone Exum is the backup free safety, although Eric Reid has experience from past years there.

• Defensive tackle Tony McDaniel, a reserve the past four games, got released Monday. He played 12 snaps against the Giants.

• Running back Raheem Mostert sustained shoulder sprain to his AC joint Sunday but the injury is not considered season ending.

• J.P. Flynn, an offensive lineman on the practice squad, went on injured reserve Monday because of a knee injury.