I am still working on this issue and need more time. In the meantime, a possible workaround to this issue is to use the LIMIT command in place of the DISTINCT directive.
master> SELECT fruit_id, fruit_name INTO @v1, @v2 FROM a WHERE fruit_name = 'APPLE' LIMIT 0,1;
Query OK, 1 row affected (0.00 sec)
master> select @v1, @v2;
+------+-------+
| @v1 | @v2 |
+------+-------+
| 2 | APPLE |
+------+-------+
1 row in set (0.00 sec)

A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:
http://lists.mysql.com/commits/16051
ChangeSet@1.2555, 2006-11-28 17:21:39-05:00, iggy@rolltop.ignatz42.dyndns.org +4 -0
Bug#20836 Selecting into variables results in wrong results being returned
This error is displayed anytime the SELECT statement needs a temp table to
return correct results because the object (select_dumpvar) that represents
variables named in the INTO clause stored the results before the temp
table was considered. The problem was fixed by creating the necessary
Item_func_set_user_var objects once the correct data is ready.

[29 Nov 2006 20:19]
Konstantin Osipov

The 5.0 version of the patch for this bug depends on a correct fix for Bug#16861 "User variables and ORDER BY RAND() LIMIT 1 product unexpected result"

[30 Nov 2006 18:09]
Bugs System

A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:
http://lists.mysql.com/commits/16240
ChangeSet@1.2296, 2006-11-30 13:09:48-05:00, iggy@rolltop.ignatz42.dyndns.org +3 -0
Bug#20836 Selecting into variables results in wrong results being returned
- Post-merge cleanup.
- Disabled this bug's test for 5.x until 16861 is resolved.

[5 Dec 2006 14:29]
Bugs System

A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:
http://lists.mysql.com/commits/16457
ChangeSet@1.2556, 2006-12-05 09:29:32-05:00, iggy@rolltop.ignatz42.dyndns.org +1 -0
Bug#20836 Selecting into variables results in wrong results being returned
- Comment Cleanup.