Victory left the Koreans on four points from two games, level on goal difference with Jordan at the top of Group B. The UAE became the first team to be eliminated.
"We stayed composed and didn't panic when we were down to 10 men," said South Korea coach Jo Bonfrere. "Ahn missed one chance but scored with his second.
"It was a big relief for us and this will give us confidence for the next game."
South Korea, who have not won the Asian Cup since 1960, survived a couple of first-half scares until Lee headed in a free kick from Lee Young-pyo four minutes before the break.
Defender Park Jae-hong was then sent off in the 57th minute for a challenge on Ismail Matar, though replays showed that no contact had been made.
From the resulting free kick, Basheer Saeed curled a left-foot shot against the bar with South Korea goalkeeper Lee Woon-jaewell beaten.
South Korea, semi-finalists at the 2002 World Cup, ensured victory in injury time, substitute Ahn latching on to a clever pass from Seol Ki-hyeon and finishing with a clinical low shot.
Bonfrere made five changes to the team that drew 0-0 with Jordan on Monday, leaving World Cup pair Ahn and Park Ji-sung out of the starting lineup.
The UAE, beaten 3-1 by Kuwait in their opening game, were unlucky not to take the lead in the 24th minute when Lee Woon-jae reacted brilliantly to keep out a close-range header from Saleh Abdulla.
Lee also kept out a fierce 30-metre free kick from Saeed in the 37th minute.
Jordan beat Kuwait 2-0 earlier on Friday to throw Group B wide open.