ha'penny = half-penny.
When you waterproof a ship, you paint the whole of the underside with tar (alquitran). Obviously, if you do all of it but leave a tiny bit unpainted, the whole job is wasted because water will get in. The ship will sink because you tried to save tar worth a half-penny. The whole of your job is ruined because of one small error.
Similar to: If a job is worth doing, it's worth doing properly.