Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.442
diff -u -p -r1.442 taxonomy.module
--- modules/taxonomy/taxonomy.module	13 Nov 2008 08:13:56 -0000	1.442
+++ modules/taxonomy/taxonomy.module	4 Dec 2008 10:19:31 -0000
@@ -334,7 +334,9 @@ function taxonomy_term_save($term) {
     $status = drupal_write_record('term_data', $term);
     module_invoke_all('taxonomy_term_update', $term);
   }
-  db_delete('term_relation')->condition('tid1', $term->tid, 'OR')->condition('tid2', $term->tid)->execute();
+  
+  $or = db_or()->condition('tid1', $term->tid)->condition('tid2', $term->tid);
+  db_delete('term_relation')->condition($or)->execute();
 
   if (!empty($term->relations)) {
     foreach ($term->relations as $related_id) {
Index: modules/taxonomy/taxonomy.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v
retrieving revision 1.15
diff -u -p -r1.15 taxonomy.test
--- modules/taxonomy/taxonomy.test	22 Nov 2008 13:43:13 -0000	1.15
+++ modules/taxonomy/taxonomy.test	4 Dec 2008 10:19:32 -0000
@@ -268,9 +268,16 @@ class TaxonomyTermTestCase extends Taxon
     $edit = array();
     $edit['relations[]'] = $term2->tid;
     $this->drupalPost('taxonomy/term/' . $term1->tid . '/edit', $edit, t('Save'));
-
     $related = taxonomy_get_related($term1->tid);
     $this->assertTrue(isset($related[$term2->tid]), t('Related term was found'));
+    // Create a third term.
+    $term3 = $this->createTerm($this->vocabulary->vid);
+    $edit['relations[]'] = $term3->tid;
+    $this->drupalPost('taxonomy/term/' . $term1->tid . '/edit', $edit, t('Save'));
+
+    $related = taxonomy_get_related($term1->tid);
+    $this->assertTrue(isset($related[$term3->tid]), t('Related term was found'));
+    $this->assertFalse(isset($related[$term2->tid]), t('Term relationship no longer exists'));
   }
 
   /**
