I hope you have a wired internet connection, because by default Ubuntu handles wireless connections with NetworkManager and it won't start if the desktop won't come up. That means if a wireless connection is all you have (I assume this is fairly common, a lot of people I know have wireless routers instead of wires running all around the place), then a problem that breaks some piece of the desktop breaks your internet connection as well. If you didn't install any command line wireless tools such as wpa_supplicant prior to that, you only have two options for internet: either get wired connection or practically give up of your wireless security for a while ('iwconfig' is there, but it can't handle WPA encryption). I think this is a serious problem, but on the other hand not everyone is willing to deal with command line only environment even then...
Anyway, if you happen to end up in a situation like that, and don't want to/can't use non-encrypted/WEP-encrypted (= weak) wireless network nor can you use wired connection (e.g. you cannot physically access any of that hardware), you can always download the necessary files on another computer and then bring them over. Without internet connection you can still run something like
apt-get install packagename
possibly with --dry-run
option if you like, to get a list of packages (including dependencies) that would be downloaded/installed in order to install the given package. Then pick up the list and fetch the packages on another computer (manual download from a reposity, or use apt-get with --download-only
option on another OS of same version), carry them over on some media and either install them manually by double-clicking or running
dpkg -i packagename.deb
or place them at /var/cache/apt/archives, where apt will find them without an internet connection when you run apt-get to do the job.
Apt also keeps log of what's been done (I think it's /var/log/apt/history.log). Check the file to see what exactly was removed when the problem came up, and then just fetch/reinstall those packages for a start.