1. If the Period to which the Invoice should be posted is already Closed, it has to be re-opened first via Setup > Accounting > Manage Accounting Periods
2. Edit the Invoice
3. Set the correct Posting Period and Save it
or
1. If the Period to which the Invoice should be posted is still Open
2. Edit the Invoice
3. Set the correct Posting Period and Save it