If the loss was taken originally through profit or loss then the subsequent gain will go through profit or loss too. Any excess gain would go through OCI.
If the loss was originally taken through OCI as it had been previously revalued upwards, so the loss then taken through OCI then the gain now taking place would also go through OCI.