CHAMPAIGN, Ill. — The sloppiness that plagued the Maryland Terrapins throughout Friday’s game against Illinois didn’t matter. All those inopportune penalties, the fumbles and the empty trips to the red zone faded from memory because quarterback Taulia Tagovailoa successfully guided his offense closer to the end zone and gave kicker Joseph Petrino a chance to beat Illinois. That’s all Maryland needed.

Petrino, who had missed from the same distance earlier in the game, nailed the winning field goal from 32 yards out as time expired.

The Terps, who were bogged down by their own mistakes through most of the evening, picked up the 20-17 win thanks to the late-game composure of Tagovailoa, who hit wide receiver Rakim Jarrett for a 26-yard completion when his team had just 47 seconds to see whether it could find a go-ahead score. Petrino, who said he had never before hit a game-winner in his football career, then became the hero Maryland needed to forgive the team of its woes from an ugly few hours at Memorial Stadium.

The Maryland players “had every chance to quit, to cash it in,” Coach Michael Locksley said. “Never felt they panicked. Never felt they looked at the scoreboard. And to us, that’s the way we’ve got to play.”

In the final minutes, Maryland’s offense, defense and special teams units all delivered. Late in the fourth quarter against a struggling Illinois squad, Maryland trailed 17-10, but when the Terps desperately needed a tying score, running back Tayon Fleet-Davis grabbed a 10-yard touchdown pass with 2:13 remaining.

The Terps’ defense came up with a critical stop. The Illini’s hopes crumbled when Maryland defensive lineman Greg Rose recorded back-to-back sacks and then the Terps forced Illinois quarterback Brandon Peters into an intentional grounding penalty on third and 28. That defensive effort set the stage for Tagovailoa to move his offense into field goal range.

“The defense did an outstanding job getting us the ball back in crucial moments,” Tagovailoa said. “They never stopped playing.”

Earlier in the fourth quarter, Tagovailoa delivered a deep pass to wide receiver Dontay Demus Jr. sprinting into the end zone for what would have been a tying touchdown, but the play was called back for a chop block penalty. And when the defense managed a third-down stop soon after, another penalty handed Illinois another set of downs. But despite these errors and an offense that stalled near the goal line multiple times, the Terps left here 3-0 for the first time since 2016.

“It shows that guys, they’re tired of being average,” said sophomore defensive back Tarheeb Still. “They want more from themselves. They want more from the program.”

Maryland’s offense started the second half operating in a rhythm it never found before the break. A quick touchdown drive, capped by Fleet-Davis’s two-yard rush, pushed the Terps ahead 10-3 early in the third quarter. They managed to replicate that success on their next possession, but this time, once they neared the end zone, Fleet-Davis fumbled on the 7-yard line, and the Illini marched down the field for a touchdown that tied the game.

Maryland’s troubles continued. Sophomore running back Peny Boone fumbled on the first play of the following drive. Even though the Terps immediately got the ball back thanks to Nick Cross’s interception, Maryland soon had to punt. The Illini eventually scored a go-ahead touchdown on an odd play. Reggie Love III fumbled at the end of a 33-yard run, but his teammate Casey Washington scooped up the ball and ran it 30 yards for the touchdown.

“I thought we all were a little affected by playing in a tough environment,” Locksley said.

Tagovailoa, who excelled in the Terps’ pair of nonconference games to start the season, threw for 350 yards and completed 32 of 43 passes, none more important than those during his final two drives. Tagovailoa completed seven of his last eight pass attempts en route to the tying touchdown and Petrino’s field goal. Early on, Tagovailoa seemed hesitant to run, but he didn’t make any major mistakes and led the offense in the most critical moments. It was the first time he started in front of a road crowd after playing in mostly empty stadiums as a sophomore last season.

During the 2018 and 2019 seasons, the previous two times Maryland started with a traditional nonconference slate, the Terps began 2-0 before disappointing defeats against Temple. Senior tight end Chigoziem Okonkwo, who played on each of those teams, recently told his teammates not to take any opponent lightly. Okonkwo said he was “not worried about this team's mind-set going into this game,” crediting the turnaround in the program’s culture.

But the Terps struggled Friday. Their offense endured a sluggish start, picking up only 40 yards in the first quarter, but the game remained scoreless thanks to Ami Finau’s block of the Illini’s short field goal attempt. Illinois had surged down the field, mostly by way of a single play: Josh McCray picked up a 40-yard reception, which was paired with a roughing-the-passer penalty that resulted in the ejection of sophomore defensive back Lavonte Gater for targeting.

Tagovailoa and the offense then found a brief spark. The quarterback connected with Jarrett for a 37-yard completion on third down, eventually positioning Petrino for a 32-yard field goal. Despite more support from the running game, the Terps’ offense stalled again in the red zone. Petrino attempted another short field goal late in the second quarter, but he missed. Maryland’s inability to capitalize on those trips into the red zone kept the Illini within striking distance, and the hosts tied the game with a field goal before halftime.

Maryland starting cornerback Deonte Banks and defensive lineman Mosiah Nasili-Kite did not travel to Illinois because of injuries. Banks recently had shoulder surgery, Locksley said after the game. The Terps’ defense was already navigating the absence of inside linebacker Fa’Najae Gotay, who left the season opener with an upper-body injury that required surgery. But with underclassmen filling in, Maryland’s defense performed well.

Before Friday’s game, the Terps had never played at Illinois, and this was the only school Maryland’s football team hadn’t visited since it joined the Big Ten before the 2014 season. But the Terps’ staff is familiar with Champaign. Special teams coordinator Ron Zook served as the Illini’s coach from 2005 to 2011. Zook hired Locksley — whom he had worked with at Florida, his previous stop — to be the offensive coordinator. Locksley calls Champaign a “special place” to his family; this is where his two oldest sons graduated high school and a place he said his two younger children consider home. During their time at Illinois, Zook and Locksley helped the Illini reach the Rose Bowl for the first time in more than two decades. Locksley’s success here as a recruiter and as a first-time Power Five offensive coordinator helped springboard his coaching career.

Now as Maryland’s coach, Locksley has worked to elevate the program over the past three years. This is still only a win against a program with a first-year coach in Bret Bielema, and the Illini (1-4, 1-1- Big Ten) already had losses this season to Virginia and Texas San Antonio. And there are plenty of areas where this team must improve. But since Maryland fired Ralph Friedgen after the 2010 campaign, the Terps have averaged just 2.2 conference wins per season, so any Big Ten victory for this program is consequential — even if it requires late heroics from a quarterback and a kicker.