Additional information:

On the line next to last, I changed it to this: b.timestamp = (SELECT MAX(timestamp) FROM furrymail_messages WHERE a.thread_id = b.thread_id)

and then it just pulls up the thread that had a reply the most recently. This is still wrong, but I thought you'd like to know.