Hello, I just recently acquired a 16GB Black iPhone 3GS, model A1303. It had an older OS on it when I received it, and I connected to wi-fi and everything worked well. (I know this because it had an inactive sim in it and would not be able to connect to 3G Data) DISCLAIMER: This phone was never jailbroken.
Since then, I have installed iOS 5 on the 3GS, and I activated it fine, (with a dead sim), everything seems to be working except— it sees wifi, connects to it, but receives no internet signal (doesn't load web pages or update notifications, etc. I also let it sit over night with no applications running in the background and it drained from 100% to 86%. Hmmmmmm? That seems odd. Especially after I installed iOS 5 on my girlfriend's 8GB 3GS which has also not been jailbroken, and has not had any problems connecting to any wi-fi network, hers has no problem connecting with the wi-fi network this 16GB 3GS has issues with.
Sounds to me like iOS 5 may need to be re-written. I tried restoring it several times, on seperate computers even. I have a high doubt in my mind that the inactive sim is causing it to not be able to receive signal from wi-fi, especially since it did connect before with the same sim. I even tried the DNS trick as shown here https://discussions.apple.com/message/16415639#16415639 but with no avail. I have tried resetting my router, (Airport Extreme Gen. 4 vers. 7.5.2), but that doesn't work. I am no idiot when it comes to electronics and networking. I am going to try to downgrade the iPhone OS to 4.3.5 and pray. Hopefully Apple has a fix for this soon.