It is likely something is out of place. What transmission does it have, 6/9 or 8/12? Is it locked in one gear (it will move) or locked in two gears (stalls if you let the clutch out)? Were you shifting it when it occurred? What gear was it in and what gear were you going to? When the gears are in neutral the notches in the shifter rails where the gear shift lever go should be centered and all in line, are they?
If you don't have the manuals now might be a good time to get the service and operator's manuals.http://www.agcopubs.com/default.aspx?model=5040&brand=44127&keywords=&searchForm=0
The parts book is available on line at https://apb.agcocorp.com/login.aspx?region=NorthAmerica
. Click on "View Books" in the Guest User area and search 5040 on the next page to see the parts book.