Well the problem with this I think is that it's not the merging function, but the way threads are displayed. Assuming you are using "linear" mode, they're sorted by time. So you'd either have to modify the times on the posts, or else come up with a new way to order posts in a thread.