Hard cases make bad law
'Hard', that is, exceptional, legal cases aren't suitable as the source of generalised laws.
In British slang a 'hard case' is a hardened criminal; a tough pugilist. It is quite reasonable to think that such characters wouldn't be the ideal choice to draft legislation. Fortunately, they aren't connected with this saying. 'Hard cases make bad law' isn't so much a universal proverb as a legal adage. It came to light in a comment made by Judge Robert Rolf in the case of Winterbottom v Wright in 1842:
This is one of those unfortunate cases...in which, it is, no doubt, a hardship upon the plaintiff to be without a remedy but by that consideration we ought not to be influenced. Hard cases, it has frequently been observed, are apt to introduce bad law.
The case required a judgment on whether third parties are able to sue for injury. The unusual nature of the case caused the judge to realise that, in the true sense of the expression, exceptions prove the rule and that, unfair as it might have appeared in some circumstances, the law was better drafted under the influence of the average case rather than the exceptional one.
The point was made explicitly in 1903 by V. S. Lean, in Collectanea:
Hard cases make bad law. that is, lead to legislation for exceptions.
See also: the List of Proverbs.