If you want to ensure your first leg, book it when it's available.
If the second leg becomes available, and there is still further upgrade availability on the first leg, cancel the existing upgrade and do the full trip for the reduced mileage.
Don't rely on cancelling the first leg and that seat going back into upgrade inventory again.