diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 61fd2be..6e7abc1 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1092,6 +1092,12 @@ class Query(object):
                     can_reuse)
             return
 
+        from django.db.models.base import Model
+        from django.db.models.fields.related import RelatedField
+        if (isinstance(field, RelatedField) and isinstance(value, Model) and
+                not isinstance(value, target.model)):
+            raise TypeError, "'%s' instance expected" % target.model._meta.object_name
+
         table_promote = False
         join_promote = False
 
diff --git a/tests/modeltests/many_to_many/tests.py b/tests/modeltests/many_to_many/tests.py
index 39fe581..2479268 100644
--- a/tests/modeltests/many_to_many/tests.py
+++ b/tests/modeltests/many_to_many/tests.py
@@ -195,6 +195,11 @@ class ManyToManyTests(TestCase):
         self.assertQuerysetEqual(Article.objects.exclude(publications=self.p2),
                                  ['<Article: Django lets you build Web apps easily>'])
 
+        # Filter values on related fields are checked to ensure the correct
+        # model class is being used.
+        self.assertRaises(TypeError, Article.objects.filter,
+            publications=self.a1)
+
     def test_reverse_selects(self):
         # Reverse m2m queries are supported (i.e., starting at the table that
         # doesn't have a ManyToManyField).
@@ -245,6 +250,11 @@ class ManyToManyTests(TestCase):
                 '<Publication: The Python Journal>',
             ])
 
+        # Filter values on related fields are checked to ensure the correct
+        # model class is being used.
+        self.assertRaises(TypeError, Publication.objects.filter,
+             article=self.p1)
+
     def test_delete(self):
         # If we delete a Publication, its Articles won't be able to access it.
         self.p1.delete()
diff --git a/tests/modeltests/many_to_one/tests.py b/tests/modeltests/many_to_one/tests.py
index 9f60c21..053c5ee 100644
--- a/tests/modeltests/many_to_one/tests.py
+++ b/tests/modeltests/many_to_one/tests.py
@@ -230,6 +230,10 @@ class ManyToOneTests(TestCase):
                 "<Article: This is a test>",
             ])
 
+        # Filter values on related fields are checked to ensure the correct
+        # model class is being used.
+        self.assertRaises(TypeError, Article.objects.filter, reporter=self.a)
+
     def test_reverse_selects(self):
         a3 = Article.objects.create(id=None, headline="Third article",
                                     pub_date=datetime(2005, 7, 27), reporter_id=self.r.id)
@@ -301,6 +305,10 @@ class ManyToOneTests(TestCase):
             list(Article.objects.filter(reporter=self.r).distinct().order_by()
                  .values('reporter__first_name', 'reporter__last_name')))
 
+        # Filter values on related fields are checked to ensure the correct
+        # model class is being used.
+        self.assertRaises(TypeError, Reporter.objects.filter, article=self.r)
+
     def test_select_related(self):
         # Check that Article.objects.select_related().dates() works properly when
         # there are multiple Articles with the same date but different foreign-key
diff --git a/tests/modeltests/one_to_one/tests.py b/tests/modeltests/one_to_one/tests.py
index c3e1704..0e5724a 100644
--- a/tests/modeltests/one_to_one/tests.py
+++ b/tests/modeltests/one_to_one/tests.py
@@ -61,6 +61,10 @@ class OneToOneTests(TestCase):
         assert_get_restaurant(place__pk=self.p1.pk)
         assert_get_restaurant(place__name__startswith="Demon")
 
+        # Filter values on related fields are checked to ensure the correct
+        # model class is being used.
+        self.assertRaises(TypeError, Restaurant.objects.get, place=self.r)
+
         def assert_get_place(**params):
             self.assertEqual(repr(Place.objects.get(**params)),
                              '<Place: Demon Dogs the place>')
@@ -75,6 +79,10 @@ class OneToOneTests(TestCase):
         assert_get_place(id__exact=self.p1.pk)
         assert_get_place(pk=self.p1.pk)
 
+        # Filter values on related fields are checked to ensure the correct
+        # model class is being used.
+        self.assertRaises(TypeError, Place.objects.get, restaurant=self.p1)
+
     def test_foreign_key(self):
         # Add a Waiter to the Restaurant.
         w = self.r.waiter_set.create(name='Joe')
@@ -89,7 +97,6 @@ class OneToOneTests(TestCase):
         assert_filter_waiters(restaurant__place__exact=self.p1)
         assert_filter_waiters(restaurant__place__pk=self.p1.pk)
         assert_filter_waiters(restaurant__exact=self.p1.pk)
-        assert_filter_waiters(restaurant__exact=self.p1)
         assert_filter_waiters(restaurant__pk=self.p1.pk)
         assert_filter_waiters(restaurant=self.p1.pk)
         assert_filter_waiters(restaurant=self.r)
