AUGUSTA – Second-seeded Valley survived a horrendous first quarter then held off determined Temple Academy in the final minute to pull out a 45-44 victory in opening-round play of the Class D South boys basketball tournament Saturday morning.

The Cavaliers (14-5) will square off in the semifinals against Monday’s winner of the Pine Tree-Gould game. No. 7 Temple closes its season at 9-10.

The Bereans nearly buried the Cavs in the first period, jumping out to a 15-2 lead. Valley spent the rest of the first half and most of the third period battling back with junior point guard Joey Thomas (23 points) leading the way.

“At the beginning it was a bad game for us,” Thomas said. “We weren’t shooting that well at all. I was like ‘I don’t want to lose this game. This is my third game here.”

The Cavs caught Temple late in the third period when senior captain Josh Brown converted a three-point play to tie the game at 30.

Valley took a 34-30 lead in the final quarter and never surrendered it but Temple had its chances down the stretch thanks to clutch play from point guard Micah Riportella and junior Ilija Ivkovic.

Valley took a 45-39 lead when Valley center Nikola Kekic fouled out with 2:11 left to play and drew a technical foul on his way out.

“Once we got in foul trouble that changed the game plan big time,” Temple coach Phil Hubbard said. “We were able to pound the post in the first quarter and then we started pounding it again in the fourth quarter but if you get in foul trouble with your big it’s very, very difficult.”

Valley didn’t score in the final two minutes and Temple went to work. Riportella came up with two steals to set up free throws from Ivkovic. A rainbow jumper from Nathaniel Wiles cut the lead to 45-44 with 1:10 left setting up a wild finish. Riportella stripped the ball from Thomas but the 5-foot-3 junior returned the favor, stealing back from Riportella with 20 seconds left.

“When I had that turnover I said ‘I’m not losing this game, I want to get that ball back,’ ” Thomas said.

The Cavs had two chances to put the game away from the foul line but couldn’t convert. Ivkovic had a good chance to put his team ahead with a drive toward the baseline but the ball rimmed out with seven seconds left to play.

“I was going to have him call timeout and draw up a play,” Hubbard said. “But the reason you call timeout and draw a play is so you can get open to the hoop. But he was open to the hoop. I thought enough was there.”

Temple sent the Cavs to the line with 5.2 seconds left and they missed a pair, but Mason Wyman grabbed the rebound to secure the win.

“Mason’s been a big rebounder for us all year,” Valley coach Curtis Miller said. “He’s our biggest body so I tell him every night you need 10 or 15 rebounds.”

Wyman and Brown each battled foul trouble with Brown, the leading scorer on the year, fouling out with eight points. Thomas picked up the slack, connecting on five 3-pointers to bring his team back.

“Once I hit that first three, I had to keep shooting,” Thomas said. “It gets my confidence up.”

Temple freshman Nick Blaisdell finished with 12 points and six rebounds while Ivkovic added 11 points and seven rebounds.