Using AppleScript to modify contacts not working
Answering my own question. Looking at errors in the console after running the above script, I saw many errors looking like:

AOSKit ERROR: (-) RAF: Invalid url -- https://[myemail]@webdav.facebook.com/[myfbid]/contacts/


(email and id changed of course). I have a 'Facebook' account set up in OS X preferences. By an educated guess, I deleted this Facebook OS X account, and then re-added it. After that, the above script works correctly.