In D6 when creating a node programmatically with a user reference, I just ignored the field if I didn't want to set it. In D7, it needs an integer or the db insert throws an error, so I put a zero in for the uid (it complains that the db_insert placeholder for the value is not an integer). I spent some time on this so I thought it would be useful to post for others. I don't know if it is a bug or just a difference in behavior, so you can just close as works as designed if you want it to work this way.