score:13
First of all, you should have detailed what did you mean with the term "modern era".
If this is related only to the post 1991 period, then there are numerous examples. Here is a list of some of such examples:
These are only few, the most public and sort of famous. If I recall anyone else I'll edit the answer to add them to the list.
If you was asking about the Soviet era too, than I can name, at least, Yuri Andropov, who had been a diplomat and the Party officer (almost 100% sure that he had direct relation to secret services) before he became the General Secretary of the Party — de-facto and it might be de-jure the head of state in the USSR, I'm not an expert in the Soviet Constitution.
Upvote:7
Willy Brandt--who went on to become the Chancellor of West Germany from 1969 to 1974--operated covertly against the Axis before and during World War II. During the 1930s, Brandt, a German national, worked with the international communist movement, including the Soviets, against the National Socialists in Germany. The name Willy Brandt itself was a pseudonym he adopted because the National Socialists knew his true identity (Herbert Frahm) and were after him. His activities included a period during which he operated inside National Socialist Germany using a false Norwegian identity. He was actually arrested in occupied Norway, but was released because the Germans did not realize who he was. He was active against the Axis in Scandinavia, operating in both Norway and Sweden. So Brandt acted as an intelligence operative under a cover identity in both a hostile nation and a nation occupied by a hostile power--qualifying him as a "secret agent" by any standard.
The term "secret agent" in your question is a little vague. Vladimir Putin was a KGB officer, but most of his career was spent inside the Soviet Union and not in an undercover capacity. He also spent five years in East Germany--an allied country with a permissive environment for the KGB--working overtly as a Soviet. Though he had a cover job as a translator, it's doubtful that the East Germans and the Western intelligence services did not know (or at least assume) that he was in the KGB. Unquestionably he was a civilian intelligence professional, but not exactly a "secret agent."
If you want to know if any other civilian intelligence professionals have ever become primary executive power holders, then one example is George H.W. Bush. During the Ford adminstration, Bush was the Director of Central Intelligence (DCI - then in charge of the CIA directly and the US intelligence community as a whole). Later, in 1989, he became the President of the United States.