When is it wrong for students to ask about previous exams known to change?
The ethical answer for students is easy in this case: if it's not clear, and remotely borderline, ask the professor.  Ideally, ask the professor publicly, so that everyone hears the answer.

That said, the real problem is that in this situation, the professor should be dealing with this publicly in one of two ways: either clearly instructing the first class not to discuss the exam until the second class has taken it, or making the exam available directly to the second class (so as not to benefit students who have friends in the first class over those who don't).