Can't format 2nd HDD in optical bay on Mid-2012 Macbook Pro 13
So the problem was with the cable. Apparently one of the small pins on the cable that connected the optical drive to the motherboard, got broken.

If it was a total failure of the drive this may have been more obvious, alas, it was not. It merely caused the drive to work in an unstable manner. 

As soon as I replaced the flex-cable with a salvaged one, the problem disappeared.