How can I get a lightswitch to work with order() in craft.entries?
Instead of using .first() try using .limit():

craft.entries.section('section').lightSwitchField('1').order('RAND()').limit(1)


I have just ran a test and this is working fine for me.

EDIT

I am using this code without any errors:

{% set entry = craft.entries.section('lorem').lightSwitchField('1').order('RAND()').first %}

{% if entry|length %}
    {{ entry.title }}
{% endif %}