Sometimes you can't see the wood for the trees. I had made some changes to fix what looked like a bug in the Add Friends search screen (ie, when you select the user with the tickbox and click Add Friend - sometimes it wasn't adding someone it should have been). Unfortunately I had totally misinterpreted why it wasn't working properly (and my change appeared to make it work properly for certain users, but not all).
I now believe I have correctly fixed it (and reverted the earlier change which was (as I suspected but couldn't seem to prove to myself) incorrect!
It should all be working now....
Steve