It is always better to advance your title first since titles allow you to own/control/make more cities. You can advance your rank after you advance your title.
You also want to avoid using medals on your heroes. Medals can be used to raise the loyalty of heroes. However you can also use gold to improve the loyalty of heroes. Since gold is easily replaced and since you cannot buy medals it is best to save your medals for titles and rank advancements.