change invoicenumber

I have created wrong invoices which i have deleted. I want to change the invoice counter but it doesn’t work.
How can i change the invoicenumber? how can i purge bad invoices ?

You’ll need to restore the invoice, change the invoice number to a value you won’t use and then delete it.