I haven’t had problems with $bp->loggedin_user->id. I had problems with the old $bp which is now $bp->displayed_user->id. It wasn’t really a problem it was my lack of understanding at first, what it represented and when it was available. It was only valid when the user was in the member theme.
Exactly where and when is $bp->loggedin_user->id becoming invalid?