DMS is constantly produced during boil and while wort is still hot.
However, it is still evaporating from solution down to ~80F. That's
why some people say cool with the lid off.
My initial concern with that is contamination.
Some people say that cooling with a lid on will re-condense the DMS
back into the wort and cause off flavors in lighter beers. Other people
use no-chill methods where the wort is put in an airtight container
where nothing can evaporate, and the wort remains hot for many
hours.
HBTer using no-chill without DMS issues:
http://www.homebrewtalk.com/f13/no-chill-80692/
I think in either situation, the key is to cool quickly to prevent DMS from
being produced in large quantities. If you cool without a lid, pitching an
appropriate amount of healthy yeast supposedly out competes most of
the infections that could result.
I'm still waiting for my first batch to ferment. So I'm just echoing the
things I've been reading here and in searches online.