The complex interplay between the 3d and 4f moments in hexagonal ErMnO3 is investigated by magnetization, optical second harmonic generation, and neutron-diffraction measurements. We revise the phase diagram and provide a microscopic model for the emergent spin structures with a special focus on the intermediary phase transitions. Our measurements reveal that the 3d exchange between Mn^{3+} ions dominates the magnetic symmetry at 10 K < T < T_N with Mn^3+ order according to the Gamma_4 representation triggering 4f ordering according to the same representation on the Er^{3+}(4b) site. Below 10 K the magnetic order is governed by 4f exchange interactions of Er^{3+} ions on the 2a site. The magnetic Er^{3+}(2a) order according to the representation Gamma_2 induces a magnetic reorientation (Gamma_4 --> Gamma_2) at the Er^{3+}(4b) and the Mn^{3+} sites. Our findings highlight the fundamentally different roles the Mn^{3+}, R^{3+}(2a), and R^{3+}(4b) magnetism play in establishing the magnetic phase diagram of the hexagonal RMnO3 system.