There's "post hoc" as in "post hoc ergo propter hoc", which is Latin for "after, therefore because of". This logical fallacy is called "post hoc reasoning" or the "post hoc fallacy". It's when you assume a causative link between two things just because they happen around the same time. For example: autism is usually diagnosed in children around the same time that they get certain vaccinations. Therefore vaccinations cause autism. Basically, it's a kind of non sequitur.
And then there's "post hoc" as in a "post hoc hypothesis" or a "post hoc justification" or a "post hoc rationalization". A post hoc hypothesis is an unlikely hypothesis to explain, after the fact, why the evidence didn't fit your theory. For example, we start with the theory that aliens are abducting people in their sleep. We later discover that the people who experience these abductions actually stay in their bed the entire time. And so we create a post hoc hypothesis to explain away the new evidence: obviously the aliens are fooling us with hi-tech holograms.
A post hoc hypothesis is not a straightforward logical fallacy--obviously sometimes you really do need to modify your theory to accomodate new evidence. But a post hoc hypothesis can be a form of confirmation bias. It shows an irrational unwillingness to change one's original theory, instead opting for a unlikely modification. If the modification were so likely, we should have been able to think of it before the evidence came in, rather than after the fact. Post hoc hypotheses can't be dismissed out of hand, but they are often suspect.
Related to the post hoc hypothesis is an ad hoc hypothesis. An ad hoc hypothesis is a modification to a theory that explains away a single piece of evidence, but otherwise has no effects. For example, if experiments, when done properly, always fail to support the existence of ESP, maybe it's because skeptical scientists have a damping effect on ESP. Ad hoc hypotheses are suspect because they too quickly dismiss the possibility that the evidence indicates a larger pattern, rather than an exception. But again, this is not a straightforward fallacy; an ad hoc hypothesis is not necessarily wrong.
This is a little off the wall, but I mentally associate ad hoc hypotheses with a part of a poem from Through the Looking Glass.
But I was thinking of a planI blame Martin Gardner for this. While explaining the concept of an ad hoc hypothesis in one of his books, he showed this poem, along with a picture of the White Knight with a large fan in front of his face. The reason why he did this, at the moment, escapes me, but it apparently made an impression.
To dye one's whiskers green,
And always use so large a fan
That they could not be seen.