Having just done this, I'd recommend unlocking the SIM first and then rooting/flashing rom.
I did it the other way around, and had a temporary scare when my mobile service vanished after the restart during the sim unlock.
Took several reflashes of different roms before it came back.