Anonymous user having user relationships
I ran into a very similar issue... Here's the code I used (modified to reflect the affected $user-&gt;uid as 0):

&lt;?php
$anon_uid = 0;
$admin_uid = 1;
// The next line makes it appear as though the relationship was deleted by the original
// user in the relationship. You might want to change the value though since Anonymous
// should normally be denied access to do this. For example, to make it appear as
// though each of Anonymous's relationship was deleted by user 1, change $anon_uid 
// to $admin_uid (next line ONLY) 
$anon_deletedby = user_load(array('uid' =&gt; $anon_uid));
$anon_friends = user_relationships_load(array("user" =&gt; $anon_uid));
foreach ($anon_friends as $friend) {
  user_relationships_delete_relationship($friend, $anon_deletedby);
}
?&gt;


PLEASE BE SURE TO BACK UP YOUR DATABASE AND TEST THIS IN A NON-PRODUCTION ENVIRONMENT FIRST.