This is the million dollar question, I see it time and time again on here and other php coding related sites and forums but I have NEVER seen an answer to it.
I don't think they use cookie since that isn't going to persist if you switch computers (unless it's DB-based cookies that some frameworks provide). I'd assume they have a relationship table in the database that keep track of the latest date a user viewed a thread.