If you just enable “sync apps” in iTunes, the next sync will remove all apps from your iPod, iPad or iPhone that you have installed locally using the AppStore app.
The trick is to download all apps from the device into your itunes installation and then sync afterwards. Connect your device, in the list on the left side in iTunes right click the entry of your device and select transfer purchases. This will transfer all your apps from the iPhone to iTunes. Then just sync as normal and all your apps will be on the phone.
BTW: If you didn’t do this, you could still redownload the apps for free (if you remember all of them 🙂 ).