If you apply a payment to the wrong invoice, you can correct the error by editing the payment transaction.