If a customer has a invoice discount and you enter a sales order and calculate the invoice discount, then you go back to the customer and delete the invoice discount record and recalculate the discount on the sales order it will not remove the invoice discount.
If you change the Invoice discount value to zero on the customer and leave the record it works as expected.
This is because there is not code to see if the sales order has an invoice discount and if it does not find a invoice discount record on the customer, it skips the calculation vs zeroing the percentage out as you would expect.
So to remove a invoice discount you have to change it to zero on the customer. At minimum there should be a warning when you delete that it will not remove the invoice discount when re-calculating existing sales orders but ideally the fix this bug.
MSFT asked me to create an idea as they fell it behaves as it should.