SSD boot drive does not work only on primary drive slot
Solution 1:
Is it definitely the Late-2011 model and not the early-2011 model? as the early-2011 model had an intermittent problem with interference on the hard drive flex cable. It would usually only cause problems when a 6G SSD is fitted. Because it is the boot drive you can find the interference can cause boot problems, sometimes locking up or beach balling (the coloured circle going around). If this is the case, the Late-2011 hard drive flex cable resolved this problem, so a replacement cable should sort it... but if its not working in the optical caddy either, then something else is going on (unless you have the 2.3GHz i5 Early-2011 machine. in which case, thats the only 2011 machine with a 3G SATA port in the optical bay, so your 6G drive wouldn't work in it). Can you confirm the generation? or the serial number will help identify the exact range and processor speed.
you can sometime fix the interference problem by insulating the flex cable a bit... or for testing the machine, connect your SSD to the hard drive flex cable, but instead of fitting it to the machine, leave the drive sitting on the side out of the casing unit so its away from the cable itself, as it will eliminate most of the direct interference issues.
I hope this helps. if you check your machine generation just let me know and i will see if i can help any further