404 on pagination but with a strange twist (error 404 only when there is single post on the second page)

While comment is absolutely correct about what you should be doing, I want to elaborate a bit why exactly query_posts() is recipe for horribly broken pagination.

Main WordPress query runs before execution reaches template file, which is actually chosen depending on results of it. When query runs for archives it takes global settings of post per page and figures out which specific posts belong on current page.

Problem is – when you are trying to tweak quantity of posts on page in template it becomes completely out of sync with main query. So while your in-template query might think that there should be something on page three… Main query is oblivious and can easily conclude that there aren’t enough posts for it. Thus 404 and execution never reaching template file.

In a nutshell – never modify main query in template file. Especially when dealing with pagination. But “never” is more reliable. 🙂