Correct, when the hand brake lever is engaged, the plunger extends. When disengaged it gets pushed into the white plastic housing. It could just need lubricated and/or cleaned so give that a shot. If that doesn't work, then just replace it.
defective switch. just coincident that the scenarios were the same.
took me about an hour to replace. did this once before installing 997 shifter.
i did try alcohol on the plunger (accessible when the ash tray/window switch plate is removed. but stated by Burg Boxster, replacement part is cheap and it's worth doing it right.