SANTA CLARA, Calif. (AP) San Francisco's rookie class made a positive first impression.

Led by first-round defensive standouts Solomon Thomas and Reuben Foster, the 49ers had to be pleased with what they saw from a strong draft class and a few undrafted free agents in a 27-17 exhibition opener victory over the Kansas City Chiefs on Friday night.

"I was excited for a lot of those guys," coach Kyle Shanahan said Saturday. "That's really what this preseason is for. You want to see it in the first game. You never play your starting guys very long. I thought our backups stepped in and did a good job."

After matching a franchise-low with just two wins last season, the 49ers are starting a major rebuilding project under Shanahan and new general manager John Lynch.

Key to that process will be the performance of the team's top two picks in April. Thomas, picked third overall, looked like he did when he dominated the defensive line in college at Stanford.

He applied the pressure that led to an early interception by Rashard Robinson, added a second pressure, a quarterback hit and made two tackles in the run game.

Foster, picked 31st, broke up a pass in the end zone and teamed with NaVorro Bowman to tackle Spencer Ware short of the end zone. Foster, who had no interceptions in high school or college, has had several so far on the practice field and was upset that he missed the one in the end zone against Alex Smith.

"I think I had something to prove," Foster said. "A lot of guys were teasing me about the pass breakup. I could have caught a pick. They were talking about I caught all the picks in practice and I can't catch one in the game, when the lights come on."

Thomas and Foster were far from the only rookies to make an impact, including third-round quarterback C.J. Beathard, who went 7 for 11 for 101 yards and two touchdowns.

Beathard overcame some early communication problems to have a strong finish and could play with the second string next week ahead of Matt Barkley.

"His first couple of drives didn't go smoothly but he kept his composure and didn't get rattled," Shanahan said. "He acted the same way he's always been. He did a good job of hanging in the picket ad getting the ball to the right spots. You can see he's a tough competitor."

Third-round cornerback Ahkello Witherspoon was not targeted once on 19 coverage snaps, according to Pro Football Focus; fourth-round running back Joe Williams had seven carries for 60 yards and fifth-round receiver Trent Taylor caught all three targets for 33 yards.

A few undrafted rookies also shined with receiver Kendrick Bourne catching four passes for 88 yards and a TD; running back Matt Breida rushing for 40 yards and Lorenzo Jerome starting at free safety and finishing with three tackles.

But this game also showed how far the 49ers have to go after winning just seven games the past two seasons and then overhauling the entire organization from the coaching staff to the front office to a significant portion of the roster.

The first-team offense failed to generate a first down in two series in the game, the defense allowed Smith to lead a touchdown drive in his only action of the game and the team was called for 21 penalties, including two that were declined and two that were offset by Kansas City infractions.

The accepted penalties cost San Francisco 131 yards and many of the infractions were self-inflicted, with 10 pre-snap penalties.

"That stuff is frustrating because we can control that," Shanahan said. "That's just concentrating and doing what you've done in practice. We obviously didn't do a good job of that last night."

NOTES: DL DeForest Buckner injured his ankle and will likely not play the next game against Denver. ... S Jimmie Ward (hamstring) could come off the physically unable to perform list this week. ... DL Ronald Blair (groin) also is expected to miss the next game.