Right now I have iPod Touch 2G (MC model) jailbroken with Blackra1n and I would like upgrade to iOS 4.0(.1) not jailbroken since my home button isn't working anymore and I want to bring it back to the apple store. My question is now, can directly upgrade from a jailbroken 3.1.2 to 4.0(.1) via iTunes or should enter recovery mode and do a restore in iTunes?
And if have to do a restore, I first need to delete my cracked apps in iTunes right?

Some knows how i need to upgrade and in what order??