Index: django/db/models/query.py
===================================================================
--- django/db/models/query.py	(revision 5881)
+++ django/db/models/query.py	(working copy)
@@ -235,9 +235,8 @@
 
         cursor = connection.cursor()
         if self._distinct:
-            id_col = "%s.%s" % (backend.quote_name(self.model._meta.db_table),
-                    backend.quote_name(self.model._meta.pk.column))
-            cursor.execute("SELECT COUNT(DISTINCT(%s))" % id_col + sql, params)
+            columns = ', '.join(self._get_distinct_columns())
+            cursor.execute("SELECT COUNT(DISTINCT(%s))" % columns + sql, params)
         else:
             cursor.execute("SELECT COUNT(*)" + sql, params)
         count = cursor.fetchone()[0]
@@ -251,6 +250,11 @@
 
         return count
 
+    def _get_distinct_columns(self):
+        "Returns distinct columns, used for count()"
+        return ["%s.%s" % (backend.quote_name(self.model._meta.db_table),
+                           backend.quote_name(self.model._meta.pk.column))]
+
     def get(self, *args, **kwargs):
         "Performs the SELECT and returns a single object matching the given keyword arguments."
         clone = self.filter(*args, **kwargs)
@@ -573,6 +577,15 @@
         # select_related isn't supported in values().
         self._select_related = False
 
+    def _get_distinct_columns(self):
+        "Returns distinct columns, used for count()"
+        if not self._fields:
+            return super(ValuesQuerySet, self)._get_distinct_columns()
+        columns = [self.model._meta.get_field(f, many_to_many=False).column
+                   for f in self._fields] 
+        return ['%s.%s' % (backend.quote_name(self.model._meta.db_table),
+                           backend.quote_name(c)) for c in columns] 
+
     def iterator(self):
         try:
             select, sql, params = self._get_sql_clause()
Index: tests/modeltests/lookup/models.py
===================================================================
--- tests/modeltests/lookup/models.py	(revision 5779)
+++ tests/modeltests/lookup/models.py	(working copy)
@@ -165,6 +165,21 @@
 >>> list(Article.objects.filter(id=5).values()) == [{'id': 5, 'headline': 'Article 5', 'pub_date': datetime(2005, 8, 1, 9, 0)}]
 True
 
+# .values(*fields).distinct().count() will return the correct number of
+# distinct records.
+>>> Article.objects.values('pub_date').count()
+7
+>>> len(Article.objects.values('pub_date').distinct())
+5
+>>> Article.objects.values('pub_date').distinct().count()
+5
+
+# And make sure it still works if no fields are passed:
+>>> len(Article.objects.values().distinct())
+7
+>>> Article.objects.values().distinct().count()
+7
+
 # Every DateField and DateTimeField creates get_next_by_FOO() and
 # get_previous_by_FOO() methods.
 # In the case of identical date values, these methods will use the ID as a
