Thanks for all the responses.
I've tried airplane mode and it doesn't fix it. In answer to the question about whether or not there is 3G at the location I'm trying, well... that is the first thing you'd check, obviously, but as I said, I can immediately connect to a data network when I have restarted my phone so clearly there is a data network at that location. This happens wherever I am, and it can be hours since I last switched on the wifi but the problem still occurs, so I'm wondering if the wifi is not switching off properly.
In answer to the question about getting 3G, or not, when wifi is switched on- that's not what I'm trying to do- this behaviour occurs once wifi has been switched off, regardless of what type of wifi network the phone was connected to before.
...and finally, this behaviour does not occur when I put the sim into a different phone, so I'm fairly sure it's not the provider.
I will see if the same behaviour occurs when my phone gets the 1.8 update and report back.