If you noticed, there is a slot at the top of the shifter shaft. The OE locking mechanism uses that to prevent rotation. If you twisted the knob while removing it, you may have broken the clip inside the knob that keeps it still.
You can try adding a couple layers of duct or electrical tape around the top of the shaft, then re-installing the knob. This extra thickness may provide a tighter fit and prevent you from having to buy a new knob.
A forum community dedicated to BMW E46, E90, and F30 owners and enthusiasts. Come join the discussion about M performance, turbo kits, engine swaps, builds, modifications, classifieds, troubleshooting, maintenance, and more!