Not only can it be a deterrent, even should it fail it still works by preventing a repeat offense.
The Death penality in most cases - as it stands now - means nothing.. 80% of the time they are not killed and they clog the court system with appeals. If the death penality didnt allow for such a long appeals proccess it might be a deterrent. They know they have atleast 10-15 years to live after that sentence is handed down.
If it was death at high noon the next day? Then im sure it would be a deterrent.