YORK – Through three quarters, it didn’t look good for the York High boys’ basketball team.

The Wildcats were down 40-33. Cape Elizabeth senior scoring sensation Theo Bowe had already scorched the Wildcats for 28 points, and York made just 5 of 23 shots in the second and third quarters.

But, for the second time this season, York threw a fourth-quarter knockout punch at the Capers and walked away with a key Western Class B win, 49-45 Friday at Butler Gymnasium.

“Our heads were maybe a little down coming into the fourth quarter,” said York junior Liam Langaas, who led the Wildcats with 16 points. “All it took was a couple of baskets and we were right back in it.

“We knew we could do it. We’ve been in this position before against them and we’ve made comebacks against a bunch of other teams, too.”

York (11-4) outscored the Capers 35-15 in their two meetings. On Jan. 15, York rallied for a 62-57 win at Cape Elizabeth.

Before Friday’s comeback could happen, York needed to stop Bowe, who made his first six shots and finished with 31 points, including five 3-pointers.

Enter JJ Galante, a sinewy 6-foot sophomore who did not play until the final minute of the third quarter. He was up tight on Bowe, same as the previous four Wildcats who had drawn the assignment. But Galante was barking out screens and getting a bit more physical. Early in the fourth quarter, he was called for a hard foul, then a questionable call seconds later. The latter awoke the crowd.

“JJ’s a great defensive player and a great passer, and we needed some type of spark, and he’s come in before and done it,” York Coach Randy Small said.

With Galante on him, Bowe scored three points on 1-for-5 shooting after making 9 of his first 14 attempts.

“He sat on the bench for three quarters and comes in and does that,” Small said. “You can’t beat that.”

Galante was also emblematic of York’s advantage in depth. The Wildcats used nine players, while Cape (12-4) was essentially a five-man iron unit, with Bowe getting a couple of quick rests from Chris Robicheaw.

“No question that depth helps (York),” Cape Coach Jim Ray said. “I gave Theo a little breather, but that’s just token. He comes out and our offense goes flat. Joey Doane and Cam Brown are 32-minute guys.”

York’s young team showed it had more energy early in the fourth quarter. Freed from having to chase Bowe, York guard Kyle Robinson came up with two quick steals that led to fast-break buckets by James McCafferty. Langaas then cut the lead to 40-37.

Doane answered with a steal and basket, only to have Galante give a nice entry pass to York’s 6-foot-6 sophomore center, Aaron Todd (13 points), who converted a three-point play. On York’s next possession, Langaas hit his second 3-pointer with 4:35 to play, giving the Wildcats their first lead since midway through the first quarter, 43-42. Langaas had made one of his previous seven shots.

Hustle plays helped York finish off the victory. Mike King scored on a putback, Todd converted inside after Langaas had the ball knocked free, and Todd was immense on the defensive backboards down the stretch.

“That killed us. What was it, 35-14 York?” Ray said of the rebounding margin. “And geez, there were just some loose balls out there that were just there for someone in a red shirt, but it wasn’t to be.”

York’s depth will be tested again today when it plays its third game in three days, hosting Falmouth at 2:30 p.m.