You won't be doing any security in T2.
You will do that in T5 either by checkin in with BA after transfering landside (which you will need to do anyway if you want to use the UA arrivals lounge which is landside) or as part of the connections proceess if you remain airside
I see little point in spending £32 for a HEX ticket to get the prority access to a security lane
Do you have any sort of status with BA or one of its One World partners (e.g. AA) or are you flying Club (business) on your BA flight?
To be honest with an 8 hour wait for your separate BA flight I'd seriously consider getting the train to Edinburgh.