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.
"Secret Agent" may not apply to Putin so much.
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.