Personally, I avoid deus ex machina like the plague - if you have to use one, it means you failed to set up the universe and the plot properly. It's like a whodunnit where there's no actual way for the reader to identify the perpetrator before the climactic reveal: there's no sense of closure for the reader.
Charles StrossI don't want to permanently damage myself! On the other hand, a couple of days off the keyboard tends to make things somewhat better.
Charles Stross