The phrase deus ex machine literally means "god from the machine," and it refers to an ancient habit of having a god pop up at the end of a play to solve everyone's problems after they've gotten themselves hopelessly confused. It's called that because the "god" usually popped up from the stage or was brought down from above with some kind of machine.
In an ancient Greek play it might be acceptable, but not generally in modern fiction.
A character ends up surrounded in an alley. The reader knows the character has no fighting ability and no weapons, but he comes up with a laser that shoots from his eye.
Likely any reader is going to say "What?" and either put the book down or start to lose faith in the author. It may take a couple such incidents before a determined reader puts the book down, but after that first point the reader's mind will be watching for those things and pointing them out--if there's even a hint of implausibility from that point on, the brain will high-light it and blow it all out of proportion.
Of course, it is possible that this character is an extra-terrestrial raised as a human and is just learning about his or her alien skills, but if that's the case it had better be extremely well developed.
This is an example of deus ex machine as it is used in modern writing. It has come to mean any situation that the character can't get out of by himself and he has to be rescued in an implausible way. Unless gods are an actual and integral part of the story, I'd suggest you avoid it.
On the other hand, if you choose to have your hypothetical alien make this fantastic discovery, there had better be some obvious and immediate reactions. Wow, how did that happen? Let's try that again! After which he blows a hole in the building next door and has to run from police sirens.
Deus ex machine is a plot device, and as such it is not entirely out of the writer's toolbox. But don't go using a ban-saw before you learn how to use a screwdriver, and please PLEASE don't use the powered ban-saw as a toothpick.
Like all other similar tools, deus ex machine should be used deliberately and with an understanding of what it will do to your readers. To every action there are consequences, and sticking in an unbelievable coincidence will just convince readers that you don't know what you're doing. Once they decide that, the book goes down and they won't read any more of your work.
Worse, they'll probably tell their friends. Then you'll need your own deus ex machine to rescue your writing career.