Thread sorting happens before loose threads are gathered. See the definition of `gnus-summary-prepare'. Threads are made, then cut, then sorted, and then gathered. I believe they should be made, cut, gathered, and then sorted. A consequence of the current order is that using `gnus-thread-sort-by-most-recent-{number,date}' in the `gnus-thread-sort-functions' will not pay attention to all messages in a gathered thread. I have verified that changing the order does the right thing, but some functions that may be used in sorting do not know how to handle gathered threads. An example is `gnus-thread-latest-date' which will choke on the string at the car of a gathered thread. I made a change to `gnus-thread-latest-date' so it understands gathered threads, but it may make more sense to do this in the function(s) that call the sort functions rather than testing that all sorting functions know how to handle gathered threads. I include the patch I was testing with. It is only valid with respect to the sorting functions I was working with, and as such isn't suitable to commit in its current state.