I had the same problem - until upgrading to ML Saturday night, my 3GS could connect by wi-fi to my Mac Mini. This has wired ethernet to the router.
Then with ML, it was either not connected to, or can't connect to the internet (because of the dreaded "self-assigned IP address: 169.xxx etc." that kept replacing my alterations ).
There are numerous suggestions, mostly pre-ML, which refer to .plist files that don't seem to be in ML. And complicated.
IN "System Preferences -Network" I tried numerous "new" networks, which didn't work.
What did work was: choose to create a new wi-fi network, and choose "Advanced". Give it a name in "Wi-fi", in "TCP/IP" choose configure IPv4 manually, with address 10.0.0.9 and Subnet Mask "255.255.255.0". In "DNS" I put the server numbers of OpenDNS, which I connect through - these would be the DNS numbers your router uses, otherwise (I think).
This didn't actually make it work. But, in "System Preferences -Sharing", Internet Sharing was ticked. I unticked it, and curiously got a pop-up warning saying that if I turned ON "internet sharing" other computers could share my internet connection (even though I'd just turned it OFF).
Turned it back on by checking it and went back to "Network" where the Wi-Fi Network name says "Internet Sharing: ON", and the details in "Advanced" that I entered are still there ("self-assigned IP address: 169.xxx etc." cast into outer darkness).
My 3GS now connects to the internet, as it did with Snow Leopard, the downside is that sleep isn't as deep as it was before - external HD light and Macally mouse LED stay on, even though "Wake for network access is unchecked in "Energy Saver"/
I did enter these details in the iPhone "Wi-Fi Networks" Static part, but now they are showing the IP address as 192.xxx.2.2, and the same in Router and DNS (but .2.1). This may not be necessary as it is DCHP that is now highlighted.