Once an invoice has had a credit memo applied, and the application of the credit memo has been posted the invoice cannot be deleted.

Even if the credit memo is unapplied, the original application transactions (although reversed) still exist in the system and the link between the invoice and credit memo will prevent the invoice from being deleted.

To delete the invoice, allow the invoice to post and then delete it, which will create the reversing entries.