Except for few edge cases, I think pagination itself is a bad idea.
Question: How would a user know that there is an interesting cat picture in post 3 of page 1534?
They don't. Users requiring to access a specific page is a non-existing requirement in common forum formats. What users want is to skip those noisy posts ("Great post", "WOW", "LOL", "Thanks"), and (hopefully) get to that cat picture somebody may have posted.
In the forum (or similar) formats, content after (say) page 10 is typically unusable to the general public of the Internet. I think we should design websites such that the system discourages users to lengthen a thread to gazillion pages.
Then how can we scale our forum without pagination?
Discourse has a fascinating way of displaying lengthy threads: It fetches content dynamically when users scroll to the bottom of the page.
Another thing you can do is trying to suppress noisy/unpopular stuff, so most of relevant, interesting stuff fits in the first page. Reddit does this.
What if user really wants to go to a specific page/post?
One interesting idea from comments was that,
user would know that there's an interesting cat picture in page 1534, because someone told them.
But see how this can break with pagination: By the time user goes to page 1534, the picture has moved to page 1531, because moderators deleted some spam posts in the thread.
Rather, we can use the concept of permalink. How would permalink work with dynamic loading? Well, you can show the user the post corresponding to permalink, associated with few posts before and after to give some context. Twitter sort of does this. User always can scroll up or down to load additional posts.
Rough navigation up and down the thread
Another requirement from comments:
I want to know about something that happened six years ago, I want to jump in about 60% of the way through and start looking from there.
There's a very popular social media website that does this with dynamic loading. Check this out:
But, dynamic page loading is inefficient. How can you solve that?
As comments has pointed out, dynamic page loading can be very processor-intensive, making browsers to crash sometimes. A remedy would be to delete the older content which user has already read from the page. In typical conversations, it is unlikely for users to go back in the thread.