usa un alias nel max() che fai nel select...

MAX(th_posts.data_ora) as pippo FROM threads
....
....
group by ....
order by pippo