If you are on 3.1.2 and want all your apps to remain compatible with 3.1.2, do not use Itunes to update your apps. Use the appstore version on your Iphone instead.
What happens when you do the update using Itune on your desktop or laptop: Itunes will download the latest app versions and some of them will only be compatible with ios 4.0 and delete the previous version. So when you go to sync your phone, you get the message that the apps were not sync because it require ios 4.0(if your Iphone is on 3.1.2). The next time you sync, it will ask you if you want to delete those apps since the affected apps will automatically be unchecked.
To avoid that, locate the affected apps that are only ios 4.0 compatible. Move them out of the mobile application directory. Connect your Iphone and choose "transfer purchase from Iphone 3Gs(or whatever your Iphone is)", and it will restore the 3.1.2 version of the affected apps back in your computer. You might have to click "transfer purchase.." a few time. Verify that you have the compatible version in your mobile application directory and then go ahead and delete the ios 4.0 version of the apps that you moved out earlier.
I almost lost the use of motionXGPS since I don't want to update my 3Gs to 4.0 yet.