Alexandre,
Sorry for not getting back to this sooner.
If the user's logged off of Facebook.com, yes, you should definitely get a null. If the user is logged into Facebook.com, it should be their ID.
The Facebook Javascript Library should actually be taking care of clearing the cookie for the user if they log off of FB.com and visit your site. However, it's possible this is related to the other autologin issue you mention.. where if a user logs of Facebook and visits your site, on that first visit, the cookie would be visible to your app, but the Javascript would clear it in when the page loads (PHP code already executed). The next page load, the cookie would be gone.
Hope that makes sense, but I can definitely see how that'd be a problem. If you think that's it, or if it rings any bells, let us know, and we'll look into this more.
Thanks,
Alex