Ok. After continuing research I found some more information.
It appears that there is a solution in this thread http://wordpress.org/support/topic/sort-posts-in-the-loop-by-recent-comments-or-activity?replies=10. I am not sure which files to put the code in. Could someone help me out here?