Apply the overpayment as a new receipt. Don't allocate it to an invoice and when you confirm it the system will automatically create an overpayment invoice. This "overpayment" invoice functions as a credit note and can be applied against another invoice through normal invoice allocation. i.e. It is selectable. (You can also partly apply the overpayment and the system will act in the same manner.)
Alternatively a refund can be issued by applying a receipt to the overpayment invoice. It will be a negative receipt and function in banking as a refund.