Seems to be the case according to chksum, with some additional details.
- iPhone reverts to 3G when in standby (iOS, any version).
- iPhone will maintain wifi if looking for iTunes-wifi-sync over network (iOS 5).
- iPhone will maintain wifi IF AN APP THAT REQUIRES WIFI is active (apps can maintain the wifi connection even when in sleep mode by using the UIRequiresPersistentWiFi API flag available to developers.
- [EDIT] When Music:iTunes Home Sharing is enabled (makes sense).
- When playing music*
- A guess: when iPod touch must wake up and use wifi for scheduled 15/30/60-minute Fetch requests, or when iPod touch uses Push connections to servers.
So essentially, the iPhone maintains a wifi connnection when it needs to because of Apple services (wifi-sync) or a third party app says to.
I noticed this phenomenon myself the other day when I restored my iPhone to factory settings - previously I always used wifi-sync, but today I decided to use wired-only and so it was interesting to see this old behavior again.
I recall setting up my friend's iPod touch and listening to it chime every 10 minutes or so (which may have been 15, psychologically speaking I didn't time it, as that was before such issues occurred to me.)
(*EDIT) Music seems very interesting. I wiped/restored my iPhone clean to reconfirm my observations and the results below seem consistent.
a. If I play music and lock my iPhone - (set a nearby Mac:Terminal to ping the IP per Hackencrash's instructions) - the iPhone will maintain its wifi connection indefinitely (past the normal 15sec timeout). This happens regardless of whether the app is in the foreground or background when I lock the phone.
b. If you pause the music, after 15 secs wifi will time-out as normal.
c. If you then resume the music OR play music (using Apple Earbud-Controls) from a locked iPhone, the wifi will STAY asleep.
d. If something causes wifi to reactivate while asleep (ex. incoming email over push connection) the iPhone will wake wifi and will STAY active as in (a).