When the teacher told you to put on your thinking cap, you were being invited to engage in mediation.
A thinking cap is simply an imaginary cap that is humorously said to be worn to enhance thinking. Some of the synonyms that can represent thinking cap include "think logically", "meditate", etc.
To put on your thinking cap means for an individual to meditate or think seriously about a particular thing. For example, a teacher can tell the students to put on their <em>thinking cap</em> before answering questions. It simply means they should meditate and think properly before they answer the questions.