probably your iphone was jailbroken before by blacksnow and that's why it becomes recovery! try to flash custom 4.0...
for original 4.0 no solution for jailbreaking!
first try to use IReb tool from iH8sn0w.com | Jailbreak your iPod touches and iPhones
try to use Fix recovery mode.. if sucess ok. in other case u have to restore it from itunes to 4.0. NO chance any more.