> Deus ex machina is a plot device whereby a seemingly unsolvable problem in a story is suddenly and abruptly resolved by an unexpected and unlikely occurrence.
Examples from Deathly Hallows.
Having no idea how to proceed on your quest of finding and destroying Horcruxes? The only soul who was there with Voldemort when the locket was planted, happens also to be magically bound to Harry and have obligation to obey Harry's every command.
Need to impersonate someone? Just pick a hair off your cloak for the potion.
Don't know where the next horcrux is? Immediate vision from Voldemort's mind to help you.
A character who has crucial information is killed? Well no, instead of using a spell like any other time, Voldemort decides to leave Snape to slowly die giving him just enough time to share his memories with Harry.
Need to check if your mortal enemy is really dead? Don't verify yourself but send the only person in the group who has any incentive to lie to you about it. (And you're supposed to be able to magically tell when people are lying by the way).
The way to destroy a horcrux is hidden in a place accessible only to those who speak parseltongue? Nope, Ron can just guess his way into an ability that was previously established to be hereditary or transfered through magic.
I could go on... the point isn't any single one of these, it's more about how they accumulate throughout the book.