Just go back and "un do " the work you did. Cut it all out : ) If they didn't pay, that means you can "assume you did work at the wrong spots so logically should cut out any mistaken work". Their main customer won't be happy, and all you thought you are doing is "fixing your mistake"
Sorry you gotta deal with that though : /