From From http://lkubuntu.wordpress.com
Apt-Undo, a simple way of undoing Apt actions
I have done many actions with apt-get that I later regretted, so I decided to make a script to undo those actions. This script can only work if you use this script instead of apt-get to install/upgrade/remove/purge/downgrade your packages.
To install, open up a Terminal window, and type in it:
apt-undo remove yourpackages
apt-undo purge yourpackages
apt-undo install yourpackages=old.version
apt-undo install yourpackages=new.version