Inherited templates are always applied before acquired templates. Other than that, you default to the old "apply in whichever order is most beneficial" rule, unless your DM chooses to abide by the type pyramid in Savage Species.

Titanic isn't labeled as inherited or acquired. Which it falls under would be up to the DM but the description of Titanic hints pretty clearly that it should be considered an acquired template ("Titanic creatures are created as the result of powerful transformation magic as well as forces of nature gone awry. [...] The transformation usually leaves a titanic creature confused or bewildered."). As a result, you'd apply Dungeonbred first, and then Titanic.