I defeated Cobalion by accident after discovering him in Alpha Sapphire and really wanted him.
Like always, if you make a Legendary Pokemon faint you can always beat the Elite Four again and he will be there to try and capture again.
Hope I helped. :)