Isn't a thread (as in the twitter terminolofy) just a sequence of notes by the same author, same parent, linked together through the e tag?
From the above note, REQ on author + parent, start at the oldest note, and see if that note is also referred in the chain, and work down recursively.

If they are disjoint, they don't refer to each other. Or if someone else is in between, the thread ends.
I don't know how much work is done in the backend or if everything is ordered on the front-end, so it can be either trivial or excruciatingly difficult :-)