I have a field which looks corrupted. How should I remove all traces of it? Problem

I have a taxonomy field that I was forced to re-create with different values after a number of errors. (I deleted the field and taxonomy and re-created them.)

It's used as an exposed filter in views and unfortunately appears to have become corrupted. Whenever I use it as a filter, in the drop down it only shows the previous values of the field (before it was re-created).

Clearing the cache, re-creating the field, clearing the search indexes, creating new views have all had no effect. Other identical field names with different machine names work fine so I'm presuming it's corrupted.

How should I go about cleaning this field from my database? 

I'm considering just re-making it under a different name but I'm worried about the consequences of leaving some corruption in my database.
This is totally off the top of my head so use with much caution, and after taking lots of backups!

// Remove taxonomy index records. Do this BEFORE removing field data tables.
$indexed_tids = db_query("SELECT field_foo_tid FROM field_data_field_foo WHERE entity_type = 'node' AND bundle = 'bundle_field_is_attached_to'")-&gt;fetchCol();
db_delete('taxonomy_index')-&gt;condition('tid', $indexed_tids)-&gt;execute();

// Remove the field data tables completely
db_drop_table('field_data_field_foo');
db_drop_table('field_revision_field_foo');

// Remove the field config
db_delete('field_config')-&gt;condition('field_name', 'field_foo')-&gt;execute();
db_delete('field_config_instance')-&gt;condition('field_name', 'field_foo')-&gt;execute();

// Clear up
drupal_flush_all_caches();


That should get tid of a taxonomy field called field_foo, and all associated index data.

Note this is for a core install - if you have other modules installed that rely on that field or taxonomy data in some way, things might not be so easy.