There's a great book by Michael Feathers on this very subject called "Working Effectively with Legacy Code".
He takes a strong "test first" approach and talks about all the work you have to do when working on a system that isn't testable to change it safely with TDD.