As Steve Michel suggested: Try doing a view source on the rendered page; it may be going to the top of the HTML and may not be visible in the browser output.
Drupal first executes all code, collecting output into a variable. At the very end, this variable is print out. If you print or var_dump something in between, this will be at the very top of the output (since that's done before any of the regular content is printed).
You even figured out the answer: use drupal_set_message (for which dpm is an abbreviation I guess?) to insert text in a nicely formatted way, somewhere in the content part of the page rather than before the tag.
If you need to print out arrays, you can use dpm(print_r($array, 1))
-- the 1 argument makes print_r
return the formatted output (and pass it to dpm
) rather than printing it out directly.