Just when it seemed inevitable that Juventus would score the goal they needed to progress and avoid yet another humiliating exit from the Champions League, the reigning Italian champions committed two fouls in quick succession.

The tie, which was overwhelmingly in their favor, was suddenly lost.

As Porto midfielder Sergio Oliveira stepped up to take a free-kick from long range, the three-man wall collapsed, and Juventus goalkeeper Wojciech Szczesny tried and failed to keep it out. Porto’s bench erupted, celebrating the goal that would decide this chaotic last-16 encounter.

Though they played down a man for over an hour, Porto controlled the damage, advancing on away goals 4-4 on aggregate despite losing the second leg 3-2.

Valerio Pennicino / Getty Images Sport / Getty

And for a second straight season, Juventus failed to make it past the round of 16, having lost to Lyon on away goals at the same stage last year.

It could’ve ended differently. The Bianconeri rallied in the second half, with Federico Chiesa scoring twice to cancel out Oliveira’s early penalty kick. The hosts attempted 31 shots and controlled nearly 70% of the possession.

Juventus forced the issue after Porto striker Mehdi Taremi was sent off for two bookable offenses: The first for a late tackle, and the second for time-wasting. Before that, Porto had every reason to believe the tie was theirs. Oliveira’s penalty kick in the 19th minute had given the visitors a 1-0 lead and a seemingly insurmountable 3-1 lead on aggregate.

But their advantage quickly evaporated. Chiesa’s gorgeous strike floated into the top corner, with Ronaldo – a relative non-factor across both legs – laying on the assist.

Filippo Alfero – Juventus FC / Juventus FC / Getty

Chiesa struck again in the 63rd minute with a well-placed header off one of Juan Cuadrado’s many quality crosses into the area.

In their way, however, were two formidable forces: Porto goalkeeper Agustin Marchesin, who produced 10 saves to keep the visitors alive, and 38-year-old Pepe, who made a game-high 18 clearances, relishing the fight in the trenches.

The woodwork contributed as well, denying Chiesa and Cuadrado before extra time.

Oliveira then stepped up to take a free-kick few could believe went in. From some 30 yards out, the 28-year-old drilled a low shot under the wall, sparking a mad reception from his teammates. Adrien Rabiot scored a header two minutes later, but Juventus needed another. It never arrived.