Fuzzyband is a Cydia app that is used for downgrading the baseband on an iPhone. It has been updated to support downgrading for iPhone OS 4.0 Beta baseband 05.13.01 on an iPhone 3G with bootloader 5.8. Version 5.8 bootloader is rarely available in iPhone 3G since it was released in a limited number of iPhones early in the production cycle.
Fire up Cydia and search Fuzzyband to install it. (Use it at your own risk, we’re not responsible if it renders your iPhone useless. If you don’t know what you’re doing, don’t do it. )
To find out which version of bootloader you have, run Fuzzyband.
To jailbreak iPhone OS 4.0 with redsn0w on an iPhone 3G, follow this guide.