Black holes and alien bacteria have one thing in common though, we can't do much about them if they happen. Or well, with bacteria we might be able to do something. Black holes, just like gamma-ray bursts, not so much.
Re: Black holes, that's exactly the sort of shit the above mentioned programs try to feed us. A black hole is invisible, eats all on it's way, and is out to get us. One day, it can just swallow the Earth, and we won't even see it coming.
What a bunch of bullcrap.
The perturbation in planetary movement, caused by a massive body would've been noticed hundreds of years in advance. The closer it'd get to our system, the more accurate would the predictions of it's effect on all the planets would become.
The probability of it actually "hitting" any of the planets or the Sun is near zero, as it'd either start orbiting our star, or fly past like so many comets do.
On the other hand, it's possible that it'd cause enough perturbations in the orbital characteristics of Earth, that we could end up closer(bad) or farther(also bad) to the Sun. Or we could end up being launched out of the solar system on a voyage to nowhere.
Still, such outcomes would be predictable with enough of headstart to start thinking on how to save our sorry arses.