WINDHAM – The Portland boys’ soccer team was back in Windham, where its magical run began. The Bulldogs weren’t about to let it end.

Liban Hassan knocked in the rebound of Sam Farr’s free kick with 3:35 left in the second overtime to lift No. 10 seed Portland to a 2-1 victory over No. 7 Windham in a Western Class A preliminary-round game at Hodgdon Field.

Portland (7-7-1) advances to a quarterfinal at No. 2 Scarborough (12-0-2) on Wednesday. Windham, the defending Class A state champion, ends the season at 10-5.

“The boys found a way to believe in each other and they beat a very talented Windham team,” Portland Coach Rocco Frenzilli said. “They dug deep, and I’m just so pleased for them.”

Back on October 6, the Bulldogs were 2-7-1 and going nowhere when they visited Windham. They handed the Eagles their only home loss of the season, 1-0, then went on to finish the regular season with four straight victories to earn a playoff berth and return trip to Windham.

“After that, just to see their attitude, their desire,” Frenzilli said of his team’s turnaround. “The boys gave us everything we wanted.”

The winning play Monday came with the prospect of penalty kicks looming. A foul near the left touchline gave Portland the ball 25 yards from Windham keeper Tom McGowan (eight saves).

As Farr lined up for the free kick, the Bulldogs’ confidence spiked.

That’s because Farr tied the game at 1 on a similar play with two minutes left in the first half.

This time, McGowan made the save on Farr’s shot, but the ball bounced free. Hassan scored on a right-footed half-volley from about 15 yards.

It was a long climb back from the 1-0 deficit created by Marc Reynolds’ goal 2:42 into the game.

“We came out a bit slow and they beat us to it,” said Portland keeper Chip Weber. “They might have thought they had it made after that. But we buckled down.”

Late in the first half, Farr took a free kick from near the right touchline. It fell into the goal just below the center of the crossbar, eluding McGowan’s outstretched hands.

“That was magic for us,” Frenzilli said. “It gave us something to work with in the second half.”

“We came out with a lot of desire and passion,” Windham Coach Colin Minte said, “but I think that goal at the end of the first half took a little wind out of our sails.”

Windham outshot Portland 23-14, including an 11-4 edge in overtime. Weber was steady in the extra sessions, making eight of his 17 saves.

“There’s no reason either team couldn’t have walked out of here with a win,” Minte said. “The ball just didn’t bounce our way.”

The second overtime was nearly over as soon as it started, when a Windham blitz resulted in the ball getting past Weber and rolling toward the goal. But sophomore back Connor Bruce reached it and knocked it wide.

Captain Tim Rovnak said Portland’s defenders “have been getting better and better, plus we have (Weber) back there,” he said. “He’s bailed us out a number of times with some great saves.”

None was bigger than with 6:30 left in the second OT, when Erik Gumaer lined up for a direct kick at the edge of Portland’s 18-yard box. The low shot made it through the wall, but Weber got in front of it.

“From where I saw at the beginning of the year to where (the Bulldogs) are today, they’re almost a completely different team,” Minte said.

“They’re playing good soccer at the right time. They’ll have a challenge on Wednesday, but hopefully they’re up for it.”