Index: django/db/models/query.py
===================================================================
--- django/db/models/query.py	(revision 7409)
+++ django/db/models/query.py	(working copy)
@@ -236,9 +236,8 @@
 
         cursor = connection.cursor()
         if self._distinct:
-            id_col = "%s.%s" % (connection.ops.quote_name(self.model._meta.db_table),
-                    connection.ops.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]
@@ -252,6 +251,11 @@
 
         return count
 
+    def _get_distinct_columns(self):
+        "Returns distinct columns, used for count()"
+        return ["%s.%s" % (connection.ops.quote_name(self.model._meta.db_table),
+                           connection.ops.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)
@@ -580,8 +584,24 @@
         # 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 = []
+        for f in self._fields:
+            if f in self._select:
+                columns.append(self._select[f])
+            else: #f in [self.model._meta.fields]:
+                columns.append('%s.%s' %
+                               (connection.ops.quote_name(self.model._meta.db_table),
+                                connection.ops.quote_name(self.model._meta.get_field(f, many_to_many=False).column)))
+        return columns
+    
     def iterator(self):
         try:
+            if self._distinct:
+                self._order_by = []
             select, sql, params = self._get_sql_clause()
         except EmptyResultSet:
             raise StopIteration
Index: tests/modeltests/lookup/models.py
===================================================================
--- tests/modeltests/lookup/models.py	(revision 7409)
+++ tests/modeltests/lookup/models.py	(working copy)
@@ -168,6 +168,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
