Ves, thats the detent for the main selector shaft, right? I hear they fail under hard use - is that why yours failed? What mileage on the tranny?
Did you have to take the tranny apart because pieces had fallen inside?
Yes it is on the main selector shaft, BMW calls it locking pin, #8 on the diagram bellow:
RealOEM.com  BMW E39 M5 S6S420G INNER GEAR SHIFTING PARTS
I attached a picture of my old broken pin next to the new one
And here is some more pictures of it
Home Page > ES#43749 LOCKING PIN - 23317501584
I had a problem with the cruise control and had changed the spring that goes inside that locking pin and presses it against the selector shaft. I was unable to pull out the locking pin then and didn't want to mess with it anymore. That fixed the cruise control problem but after about 2 months I started having difficult time taking it out of gear occasionally. Last week it just got stuck in 3rd gear. The top part that of the locking pin that touches the selector shaft had broken into 4 pieces(attached picture below) and the roller that is on top of the locking pin got jammed between the selector shaft and trans housing. Two of the pieces had fallen into the transmission and had been collected by the big round magnet that sits at the bottom which apparently works well, and two other pieces, the roller and a small pin had jammed in the housing.
I have 156000 miles on the car, so can not tell if its due to driving style or mileage. I do drive spirited but do not abuse the car. I drive manual transmission since 17 years old and I am 34 now.
Anyway I would definitely recommend changing that pin as a preventive maintenance since it is inexpensive and not difficult to do and saves you from taking the transmission apart if it fails!