Hi,
This is a common problem. If the "O" rings sealing the transfer pipe into the thermostat housing have been leaking, then there will be a lot of crud built up siezing it and stopping you from turning and removing the pipe.
As the new thermostat comes complete with the housing, sometimes penetrating oil and lot of tapping of where pipe goes into housing may help to release it without the worry of damage.
If this fails, then you have to hammer and chisel to split the thermostat housing, or maybe you have a small angle grinder to grind a vee in the boss and split it.
I would advise that you also get a new transfer pipe and "O" rings, as even if you do release it, it may well be pitted and difficult to get a good seal in the new thermostat.
Also, a word of caution, if your new thermostat has a thinner flange than the old, make sure you use shorter bolts, at least in the rear thermostat fixing hole, as it is a blind tapped hole.
Also, have you got a new seal ring for the thermostat as well. my new stat didn't have one supplied, had to get separately. A smear of grease around "O" rings helps to get pipe back in.
I also found it easier when re fixing the transfer pipe, to use an 8mm hex head bolt instead of the torx head one, I found it's easier to locate and get started if you can use a deep ofset ring spanner.
Roger