I have seen may nice products that plug into the dock port and uses the iphone power as a flash. The only problem i see with this is that you have to carry another device with you. You might as well just carry a flashlight round all the time.
I fix iphones for a living, and i know how much room is inside of a 3g or a 3gs. (this hack would be almost impossible with a 4 or a 4s considering how little free space there is.
I will show you how to add three low profile leds to the back of your iphone 3g or 3gs and have it powered by the internal battery.
Step 1: Tools and Parts needed
parts and supplies:
--3 low profile leds from radio shack part # 276-0024 they are $2.49 each
--a micro switch, since i do iphone repairs, i used an extra mute switch i had from a previous repair. I would recommend you buy one of these since they use a thin ribbon cable that will make the hack turn out better. just search ebay for "3gs replacement headphone jack". This will cost you $2.81
--Very thin wire. i found some at radio shack for 5 bucks part # 278-502
--paperclip that you can heat-up to melt a hole. (you will also need it to remove the sim from your phone)
(optional tools that help)
--helping hand (the thing with the magnifying glass and clips)
--Apple "black stick" used to open iphone
--miltimeter to test direction of led and battery