Substitute Reza Ghoochannejhad scored a contentious injury-time winner as Iran defeated United Arab Emirates 1-0 to seal top spot in Asian Cup Group C on Monday.
Both teams had already booked their place in the quarter-finals ahead of the last pool match at the Suncorp Stadium and it appeared that UAE, who led the way on goal difference, would finish first.
However, Ghoochannejhad - who came off the bench in the 72nd minute - headed home in stoppage time, with replays suggesting the striker may have been in an offside position.
Carlos Queiroz's Iran enjoyed the better of the first-half chances, with Sardar Azmoun - goalscorer in Thursday's 1-0 victory over Qatar - a particular threat.
The second half proved something of a war of attrition as clear-cut chances were few and far between, but UAE's brave resistance was undone at the last.
UAE will now face the winner of Group D, meaning a likely last-eight clash with defending champions Japan, while Iran tackle the runner-up from that pool, which concludes on Tuesday.
UAE controlled the opening stages and Khamis Esmail fired an early warning in the sixth minute with a long-range shot that flashed past the left-hand post.
Iran settled into their stride, though, and Azmoun felt he should have had a penalty when he went to ground under a challenge from Majed Naser, but the goalkeeper appeared to make contact with the ball first.
Azmoun was proving a particular nuisance to the UAE defence and only a deflection prevented his side-footed effort from the edge of the box from troubling the goalkeeper.
Mohanad Salem was then on hand to make a crucial block from Azmoun's back-post header as Iran turned the screw at the end of the half.
UAE saw claims for a penalty dismissed by referee Ryuji Sato shortly after the restart as Habib Fardan Abdualla was sandwiched between the Iran centre-backs and went to ground.
At the other end, Azmoun continued to cause problems for the UAE defence, the Rubin Kazan striker rose to meet an Andranik Teymourian's corner, but the delivery was just two high and he skewed his header wide.
UAE briefly threatened themselves and Esmail's fierce free-kick flashed wide, while Ali Ahmed Mabkhout crashed an effort over the crossbar from the edge of the box with 15 minutes remaining.
Just when it looked like the game would finish all square, Iran had the last say. UAE failed to clean their lines from a corner and, when the ball was played back into the box, Ghoochannejhad nodded past Naser.
Get the best features, fun and footballing frolics straight to your inbox every week.