I would like to upgrade the firmware. If I do this, will my phone still be unlocked?
If you flash/upgrade/debrand the phone, then it will be relocked, so you need to unlock it again.

Also, I noticed since unlocking the phone it switches itself off every now and again. What might be causing this?
Probably this is a software problem. Reflash your phone completely(MAIN, FS, custom pack), and then unlock it. It should work then.

Before reflashing the phone, backup the user data(contact list, pictures, ring tones etc.) from phone's internal memory, because during flash it will be lost.