The Swiss capitalised on late mistakes by young Swedish skip Niklas Edin to complete a come-from-behind win.
Edin, 24, whose flashes of brilliance have drawn comparisons with top Canadian curler Kevin Martin in his early years, was slightly too heavy on his last rock, leaving the door open for Stoeckli to score two and put the game away.
Stoeckli, who failed to make the medal round in Turin and finished out of the medals at two world championships, admitted to a moment of uncertainty until he saw team mate Simon Struebin react down the ice.
"I was just waiting for one guy telling me yes or no, and at the moment Simon was lifting his arms up I knew that's the medal. That was just amazing," the 33-year-old Stoeckli said.
"Finally -- we finished fourth twice at the worlds and I told the guys 'I just don't want to leave this place again in fourth place'. We're all so happy that we finally got that medal."
Edin's Swedes surprised curling fans by knocking off world champions Britain to advance to the medal matches, and in the ninth end he pulled off one stunning shot in which he cleared the house of four Swiss rocks.
"We were really lucky to get out of that ninth end, of course, and getting out of that we should have had a better start in the 10th end as well," he said.
"(There was) some pressure on it and we didn't have that much time left either."
Martin's Canadians will battle Norway later on Saturday for the men's curling gold.