As for as my knowledge Heydrich was serving under Himmler from 1931 as head of SS-Reichssicherheitshauptamt; head office of Reich Security. Himmler is also one of the most powerful man in the Nazi party and one of the key associate of Adolf Hitler.
Since, Himmler personally controlled most of the SS operations and activites, its most likely that Heydrich would have take direct orders from Himmler.
As commander of all police forces in Nazi Germany Heinrich Himmler was actually subortinated to Wilhelm Frick who was subordinated only to Hitler, so Heydrich actualy was getting Hitler orders by Himmler. They had extremly weird relation. Their hunger for power often made them to single out of Gestapo and SS periphery. They barely endured each other, but they formed strong partnership and becamed great power in NSDAP. Heydrich abilities were very big and he could manipulate with Himmler easily what resulted with very popular acronyme HHhH (Himmler's brain is called Heydrich). After The Blomberg-Fritsch Crisis of 1938 Heydrich was ready to get resignation from Himmler, but he didn't got it altough Himmler was very angry. After Heydrich was killed in Prague, Himmler stayed only realpower in SS till the end of the war.