I have a different answer. It might be a little lateral-thinking, but word choice matters! The treasure is in locker:
The first thing to really pay attention to is when John says:
"I do not think Peter will know".
Why didn't he say I know for a fact Peter does not know? Because he does not know for a fact that Peter does not know. It's like when I go with my friend to play roulette and he puts all his money on 32. I try to talk him out of it by saying "take your money back, I do not think 32 will come up". Why did I say that? Do I know for sure 32 will not come up? Of course not, it's just that it's so unlikely that I do not think it will this time. Same with John, he does not know that Peter for sure does not know where the treasure is, it is just that it is unlikely that he does.
Having determined this, the next step is:
So we cannot eliminate row B, because if John was given row B then Peter could have been given columns 3, 6 or 7. Only if he was given column 3 would he know where the treasure is - that's a 33% probability and unlikely to happen in a sense that an even that occurs 66% of the time is more likely to happen than one that occurs only 33% of the time. Right? That is why John says he does not think Peter will know.
The only row we can eliminate is row A. If John was given row A then Peter would have a 50% chance to either know or not know where the treasure is, so John would be unable to say that he doesn't think Peter will know, because with a 50% chance he cannot take a position of what is more likely to happen - Peter knowing or not knowing.
It's a breeze now:
Now Peter says he didn't know where the treasure was, but now he knows. So Peter was not given columns 3 or 5 because then he would know right away. The only way for him to know where the treasure is after only eliminating row A is if the treasure is in F2. Now for John to know where the treasure is after hearing Peter would have to mean that he was given row F and he also deduced that the treasure is in F2.
And that's that.
You may have noticed that
John did know for sure that Peter does not know the location of the locker. Why didn't he just say that then? The problem is, if John was given row F and he said Peter cannot know the location of the treasure, thus eliminating both rows A and B, then if Peter next said he knows where the treasure is, John would be stuck, because the treasure can be in F2 or F7. Since John knows this, he chose his words carefully to only eliminate row A, because he is smarter than your average Joe.
Now if Peter says he knows where the treasure is, like in the problem, then it's in F2. If Peter says he still doesn't know then John can eliminate row B by saying something like "I actually knew you didn't know even before you said anything". Now if Peter knows, then it's in F7 and if he still doesn't know then it's in F1. John was just trying to make sure he can figure out the location.
Also notice that
John cannot have been given row A. I already mentioned why, but there is another reason - because his statement would be inconsistent with itself. If John was given row A, and he says that he does not think Peter will know, then that means that he thinks Peter will not know. This is just how logic works. If he thinks Peter will not know, then he thinks Peter was given column 2, because that's the only column where Peter will not know. If John thinks Peter was given column 2 then the treasure will be in A2. So if John was given row A and he does not think Peter will know, then he thinks treasure is in A2. How can he then say that he has no idea where the treasure is? He has some idea - he thinks it's in A2! This is logically inconsistent so he cannot have been given row A and make the statements that he makes.