Cool, glad to hear I'm not going crazy. Apparently there is a security enhancement with Sitefinity 4.2 (and presumably future releases) which now prohibits inline server side code. For those who have the same problem, the key is to use an external, self created control, which can override the default widget template.
you should be able to specify a TemplatePath (from the widget, Edit > ControlDefinition > Views > * > TemplatePath) to point at your ascx control, which can contain server side code without issue. This requires deleting the TemplateKey (same place) definition (a GUID associating widget and template).
Now if only I could get Sitefinity to stop re-inserting the TemplateKey whenever I delete it and click save. I suspect it might do this if I have made a code error, although the code I am trying to run works perfectly from VS2010Prem.
Sorry for the late reply, CS5.5 installation (still no native x64 Illustrator!) required the loss of Outlook yesterday afternoon.