Looking good. I'm testing this, but the call to term_exists
never succeeds, i.e returns null.
Which doesn't make sense after looking at the term_exists source http://core.trac.wordpress.org/browser/tags/3.5/wp-includes/taxonomy.php#L0
If I run the SQL that term_exists generates I get the right thing. I'll have to keep digging.