Sounds like a compression spring. Does it skip the gear after being unable to select it?
You'll probably get a code saying "gear not selectable".
The spring is kind of a PITA to replace (I did it in mine), but it costs less than $5.
2002 BMW M3 - Stock