To reproduce the bug:
0. login as admin
1. create a new course, select a user and give it a Role->Teacher permissions
2. set the course as "unavailbale to students"
3. now logoff and login as the editing teacher user defined at point 1
4. editing teacher cannot see nor edit the course
If you login as an Admin and uses the "Login as" function from whithin editing teacher user's profile, trying to access the course produce teh message "This course is not available to students".