Can you run the following SQL directly in the database? The code that does the delete check looks for something like this:
select * from civicrm_contribution where contribution_page_id=<put the page id here>
There is maybe some phantom entry still.
Here is a proof-of-concept extension that shows how to override bits of CiviDiscount to make it possible. It might be better to fix this in CiviDiscount itself, but meanwhile it's a good way to test and better define the requirements.
This is copy-pasted code from a project. I tried to package it as ...