Index: django/db/models/query.py
===================================================================
--- django/db/models/query.py	(revision 5047)
+++ django/db/models/query.py	(working copy)
@@ -923,7 +923,7 @@
             if field.rel: # One-to-One/Many-to-one field
                 new_table = current_table + '__' + name
                 new_opts = field.rel.to._meta
-                new_column = new_opts.pk.column
+                new_column = field.rel.field_name
                 join_column = field.column
                 raise FieldFound
             elif path:
