To beat the rap

to be acquitted of an accusation; - especially, by some sly or deceptive means, rather than to be proven innocent.

See also: Beat