To recreate, to to Admin CiviCRM >> Gender Options and try to delete "Transgender". You'll get the following invalid query:
WHERE ( .gender_id = 4 )
Pretty sure the problem is in Core/BAO/OptionValue.php, updateRecords. So once you fix please verify a few of the other option groups that are handled by this function.