Deu nó no cérebro - There was a knot in/on the brain
Even more literally, “it gave a knot in/on the brain”
When you get things confused/switched around (i.e. you meant to say left instead of right, you get people confused in your head, etc).
A close cousin of “getting one’s wires crossed”, the “brain fart” and “blonde moment” in English.