近づいています、シンプルなUNION ALL
あなたがやりたいことをするべきです;
SELECT MAX(del_time), COUNT(*) cnt, MAX(subject) subject FROM (
SELECT to_delete del_time, thread_hash, subject
FROM messages
WHERE to_user_id = 27 AND `to_delete` >= SUBDATE(NOW(), INTERVAL 720 HOUR)
UNION ALL
SELECT from_delete del_time, thread_hash, subject
FROM messages
WHERE from_user_id = 27 AND `from_delete` >= SUBDATE(NOW(), INTERVAL 720 HOUR)
) a
GROUP BY thread_hash;