Very nice indeed. We've been doing a lot of stuff here lately based on similar concepts, but this is a neat twist, particularly the code to sort based on most recent reply.
At the risk of needlessly poking my nose in, I offer a modified version:
1) Refactored the code to make fewer redundant function calls. I can only speculate whether this would put marginally less load on the server and perhaps render pages faster, but I find it cleaner and easier to read if nothing else. I perform some of the operations quite differently, some may find it instructive.
2) Added code to display the originator of the topic, in addition to the most recent commenter.
3) Reformatted the output a bit to look more like this forum (and more forum-like as a whole.)
See it
here.