found it!
forum_print_posts_threaded gets called with $course->id:
forum/lib.php in the function forum_print_discussion:
case FORUM_MODE_THREADED :
if (forum_print_posts_threaded($post->id, $course->id, 0, $ratings, $reply)) {
but then calls
isteacher($course->id) which is the same as $course->id->id which is obviously bung.
line: 2672: $by->name = fullname($post, isteacher($course->id));
At least, I think that's what it could be from looking at the code but I'm right in the middle of merging something tricky so can't take too much time to confirm