SANTA CLARA, Calif. (AP) — A quick whistle saved San Francisco linebacker Marcell Harris from a colossal mistake and helped deliver the 49ers a key win in their playoff hunt.

Harris appeared to fumble away an interception in the third quarter against the Houston Texans only to get bailed out when the officials ruled his forward progress was stopped.

The Niners (9-7) then responded with a touchdown drive to take the lead for good and move them a step closer to a playoff berth with the 23-7 win Sunday.

“I thought I was down,” Harris said. “I kind of heard a whistle as I was being held up. But a guy was behind me but we got that ball back and gave the offense a chance to score. So I can’t ask for any more.”

The play in question came on Houston’s first drive of the third quarter when Davis Mills’ pass over the middle to Chris Conley was intercepted by Harris.

As Harris tried to make a play on the return, he got stood up and Conley knocked the ball out. Teammate Rex Burkhead recovered and it looked like the Texans had a first down in San Francisco territory.

Then the officials gathered and made their ruling.

“We ruled that forward progress was stopped,” referee Carl Cheffers told a pool reporter. “He was being driven back. So by rule, the play is dead at that point and any subsequent loss of possession is irrelevant.”

It turned into a bad break for the Texans (4-12), who have had plenty of them this season.

“I mean, to be very honest with you, I thought Con-man within the time of the play was able to get the ball back out,” receiver Brandin Cooks said. “But I’m not the ref. That’s Con, giving that effort. It’s unfortunate. You just would have hoped the call was in our favor. But it wasn’t.”

The Niners then took a deep shot on the next play and got help from the officials again when Terrance Mitchell was called for a 37-yard pass-interference penalty against Brandon Aiyuk.

That set up the Niners in the red zone and Trey Lance finished the drive with an 8-yard TD pass to Elijah Mitchell to give San Francisco a 10-7 lead that the 49ers never relinquished.

“Those are two of the best calls I’ve seen this year,” coach Kyle Shanahan said with a smile. “I felt Marcell made a hell of a play, and then I did feel we were very fortunate.”