BOSTON (AP) — Liam Connor kicked a 42-yard field goal with 2:11 remaining and Boston College rallied with 20 points in the second half to beat winless Virginia 27-24 on Saturday.

Thomas Castellanos threw for 183 yards and two touchdowns as he and the Eagles (2-3, 1-2 ACC) overcame a dreadful first half and many of their own mistakes to hold off the Cavaliers (0-5, 0-2).

 Lewis Bond caught seven passes for 104 yards and a touchdown and Pat Garwo ran for 87 yards and a score for the Eagles, who trailed 21-7 at halftime after gaining just 120 yards of offense in the first two quarters.

“We knew we came out slow. We knew we had to pick it, especially me,” Castellanos said.

Castellanos and the offense regrouped in the second half, rushing for 162 yards after gaining only 41 on the ground in the first half. The Eagles scored 17 unanswered points before Virginia briefly tied it on a field goal with 7:10 left to play.

Tony Muskett returned from a shoulder injury and threw for 247 yards and three scores, including a 39-yard heave to the end zone where Malachi Fields leaped between two defenders and grabbed the ball for a Virginia touchdown.

Muskett finished 22 of 34 with one interception. He was also sacked five time as Boston College’s defense helped overcome the Eagles’ offensive woes, holding Virginia to 46 yards of offense in the second half.

The Eagles took their first lead on a 33-yard touchdown pass from Castellanos to Bond with 1:04 left in the third quarter. Bond was already outside two defensive backs when he caught the ball in the flat and turned upfield with nobody to touch him.

Bond also helped set up the Eagles’ first touchdown with a 34-yard reception, breaking through twice after the Cavaliers appeared to have him stopped before finally getting him out of bounds at the 6 late in the second quarter.

“I feel like I have to break those tackles in order to stay on the field because that’s what I bring to the team,” said Bond, who had career highs in catches and yards.

UVA outgained BC 267 yards to 120 in the first half and forced two turnovers, both interceptions on passes from Castellanos. Josh Ahern caught the second and returned it 17 yards to the Boston College 37-yard line, helping set up an 18-yard touchdown pass from Muskett to Washington that put the Cavaliers up 14-0 early in the second quarter.

“You can’t take your foot off the gas. You can’t become complacent,” Virginia coach Tony Elliott said.