HOUSTON -- Blaine Gabbert was playing poorly. Again. Then he hurt his shoulder and, presto, he threw a touchdown pass.
That doesn't exactly inspire confidence in the 49ers' top backup spot behind Colin Kaepernick entering the regular season.
But then came Josh Johnson in relief Thursday night, and he delivered what coach Jim Harbaugh termed "a heck of a game" in the 49ers' eventual 40-13 win over the Houston Texans in the exhibition finale.
Will it be enough for Johnson to survive Saturday's cuts and make the 53-man roster, if not unseat Gabbert as the No. 2 quarterback?
Harbaugh declined to state how the backup order will shake out. But the coach wants to keep both Gabbert and Johnson behind Kaepernick, noting the 49ers carried three quarterbacks in the past, even if they played the final eight games last season with just Kaepernick and Colt McCoy.
Said Johnson: "I don't put the roster together. I don't determine the depth chart. All I determine is my performance, and I felt like I was able to make a strong case to be on this team."
Johnson was 14 of 17 for 135 yards with three touchdown passes, including one on his first snap, a 13-yard throw to Bruce Ellington just before halftime. Johnson did have a pass intercepted and returned for a touchdown, after wideout L'Damian Washington tipped it to cornerback Andre Hal.
Gabbert got the surprise start after Harbaugh decided Wednesday to let Kaepernick and almost all other starters treat this as a bye before the Sept. 7 regular-season opener, just up Interstate 45 against the Dallas Cowboys.
Gabbert was 4 of 11 passing for 60 yards, but it was his touchdown-pass finish that had Harbaugh jazzed. Gabbert's throwing shoulder got hurt on a hit by Julius Warmsley, but Gabbert stayed in the game and promptly threw a 14-yard touchdown pass to Asante Cleveland.
"Blaine got hit on the shoulder there, pretty good thump," Harbaugh said. "To come back in and fire a perfect pass, one foot in front of the numbers, and Asante made a great play on it."
Gabbert said his throwing shoulder is "fine," even though he wasn't sure what postgame X-rays officially revealed. Gabbert played through the pain by relying on adrenaline and motivation to produce a touchdown drive.
Gabbert said of his overall performance: "Some ups and downs. We were in a little rut early in the game. But as we became more consistent we started moving the ball down the field. It was nice to finish that last drive off with a touchdown."
While Gabbert's grasp on the No. 2 job could be best tied to his $2 million guaranteed salary, Thursday's show stirred reminders of his struggles in the first two exhibitions, not to mention his former tenure with the Jacksonville Jaguars.
Gabbert was 1 of 6 for 11 yards before throwing into double coverage and finding Derek Carrier for a 32-yard completion. His overall exhibition stats: 22 of 47 for 186 yards, two touchdowns, two interceptions and a 54.0 passer rating.
Johnson hopes this exhibition finale wins him the roster spot that his 2012 performance somehow couldn't, when he lost out on the No. 3 job to Scott Tolzien.
"It was really tough, to be quite honest," Johnson said in reflecting on his 2012 release. "It was a lot of different emotions. I looked at myself, 'What happened?' A lot went into it. There were things I felt I could have done and didn't do.
"I made the determination to do everything I can on my behalf. As long as I can walk with my head high and not live with any regrets, that's the best I can do for myself, and I feel I've done that. I hope coaches keep taking notice of that."
"It's good to go out with a bang and make any play I can to get on the 53-man roster," said Osgood, a 12th-year veteran who got cut for salary purposes before last season but re-signed in Week 2.
Cook made an interception 42 seconds before halftime. Neither Johnson nor Acker is expected to go unclaimed if the 49ers waive them in hopes of re-signing them to the 10-man practice squad Sunday.
SEPT. 7 OPENER
49ers at Dallas, 1:25 p.m. FOX