Here is an example of this happening in 2019.
This article describes what happened.
We had nearly given up on getting the last piece and solving the riddle. We thought we had a minor result, one that was interesting, but in no way solved the problem. We guessed that there would be another five years of work, at best, before we would be able to solve the puzzle
While reading our research article, we suddenly realized that the solution was before our eyes. Our next reaction was 'oh no – we’ve shot ourselves in the foot and given away the solution