Hi Luciano, thanks very much for the detailed reply. Since I wrote I disabled vboptimize and the problem didn't appear again, but... it's been enabled again for the last 6 hours and the problem hasn't happened again either! I will just have to wait and test the disable solution if it happens again.
If it is a problem with vboptimize and it happens again then I will go with your modification above as vboptimize makes such a big difference on one of my sites that I consider it just about essential.
By the way, the tab did disappear and going to the gallery front end, I'm pretty sure, produced a very similar error SQL error; category related and missing the sort by variables. I didn't note this down though so couldn't confirm that unless it happens again.
I apologise for that vague reply, and thanks again for your input.