I've done both. If I had to choose one, it would be the Galapagos, hands down. Biodiversity, big animals, and wonderful topside tours all combine to make it a superior destination, in my experience.
There is more info in the thread about Galapagos land-based vs live aboard.
Cocos was special too - but you will burn almost 3 days of your vacation doing the round trip, open ocean crossing (and it can be very, very rough). If the hammerheads are not there (they are seasonal), I think it would be a very disappointing experience, especially as I understand that the white tip shark rodeo night dive is no longer being offered due to diver safety concerns.
The water temps were warmer in Cocos (above 80F, in July), and the visibility generally better than most dives I have done in the Galapagos.
We were lucky and we saw huge migrations of hammers on most dives in Cocos, and the shark rodeo night dives we did were extraordinary.
But then again, we saw schooling hammers, along with huge migrations of Galapagos sharks, and the occasional flyby whale shark, all on any given dive in the northern Galapagos.
Hope this helps.