Chapter 122, paragraph beginning with "And right now, Harry James Potter-Evans-Verres was still a walking catastrophe"... and the stuff immediately preceding and following it. Seems like a pretty direct answer to your question.
It's been a while since I read it, but off the top of my head I can't recall any blatant cases of Deus ex Machina. I'd ask for concrete examples, but I don't think it would be useful. I'm sure you can provide an example, and in turn I'll point out reasons why it doesn't count as Deus ex Machina. We'd argue about how well the solution was explained, and whether enough clues were presented far enough in advance to count as valid foreshadowing, and ultimately it'll come down to opinion.
Instead, I can go ahead and answer your question. Eliezer definitely meant to teach useful lessons. Not everything Harry does is meant to be a good example (I mean, even Eliezer knows better than to write a completely perfect character), which is probably why he gets into all that trouble. But whenever a character goes into Lecture Mode while solving a problem, it's meant to be both useful and accurate.
Wait a minute, are you talking about Lecture Mode when you say "Deus ex Machina"? I can kind of see that: the situation seems hopeless and then someone (usually Harry) gives a long explanation and suddenly the problem is solved. Thing is, these lectures don't pull the solution out of nowhere. The relevant story details were established beforehand, and the lecture just puts them together. (Or at least, that was the author's intent. As I said, it comes down to opinion.)
And yes, it would kind of make him immune to dying... in cases where he could be accidentally rescued.
By a time traveler, who doesn't need to do much - only to appear and make the paradox possible. That makes the list of possible cases much more extensive than a first year student locking the door.
And here's the line I was referring to:
Correct me if I don't remember something, but that episode didn't imply that he would be able to create and manipulate tentacles like he did in the book's final.
There is one thing that really striked me after reading HPMOR, it's a certain pattern of events that repeats many times.
1) Harry gets into grave trouble due to his self-assurance and indiscretion
2) The author saves Harry using deus ex machina
And this makes me wonder - was Harry intentionally shown as an anti-example of rationality, or it just happened this way?