aptitude keeps track of when it installs a package to satisfy a dependency and then uninstalls it when it is no longer needed to satisfy any dependencies. If you want to install a library for a non package managed program (e.g. you want to compile the latest wine) you can just use apt-get which doesn't mark them for removal when they're not depended on.
Cheers & God bless
Sam "SammyTheSnake" Penny