Royal tutor
After merely two years Klingenstierna was granted a leave of absence from his professorship in physics. He was commissioned to carry out experiments to develop the artillery. One reason for this change in his activities was no doubt the fact that a great misfortune had befallen him at home, and he was in poor health. One of his sons, Zacharias, drowned in the Fyris River in June 1752, and three days later his wife Ulrika died. It is said that, feeling frail and devastated, he visited his father-in-law, but fell ill there and after that felt pain at the slightest touch and was experiencing ”shortness of breath.” In spite of this, when he was summoned to serve at the court in 1756 he answered the call. Duty called!
There was an attempted coup d’état in Sweden in 1756. They tried to introduce an autocracy with the king as ruler. The coup failed. The Hat Party (the other party being the Cap Party) came into power. The royal advisers were replaced, against the wishes of King Adolf Fredrik and Queen Lovisa Ulrika. Prince Gustaf's tutor, Olof von Dalin, was replaced by Samuel Klingenstierna, a man ”of whom the country can boast regarding the respect of other countries.” At first he was received grudgingly, since he had been forced upon the royal court and the prince.
Klingenstierna was not supposed to teach mathematics and physics primarily. According to the directives, he was chiefly to teach history, ethics, natural and international law, subjects that he himself had encountered during his early studies in law. He now tried to get the crown prince to understand and be interested in Pufendorf's theories, in which the word ”quantitates” had led Klingenstierna to mathematics. However, the prince was mostly interested in drama and theater.
With time, Prince Gustaf came to be more affectionate toward his tutor. Queen Lovisa Ulrika, in particular, demonstrated her immense gratitude by later erecting a stately gravestone in honor of the crown prince's tutors, Klingenstierna and Dalin.
A further token of the great respect Klingenstierna enjoyed toward the end of his life is the fact that he was awarded the Order of the North Star in 1762 and was appointed State Secretary in 1762