When Stephen Mills spotted a dusty old safe in a museum in Canada, he thought he’d try to crack the code, “just like in the movies”. But when he began turning the dial, he wasn’t expecting a Hollywood ending.

For years, anyone who visited the Vermillion Heritage Museum in Alberta would have passed by a large, black metal box. Staff knew it had come from the long-gone Brunswick hotel and was donated to the museum in the 1990s. But its code and contents remained a mystery for decades – until Mills unexpectedly cracked the combination.

Mills, a resident of Fort McMurray, also in Alberta, was visiting the museum with his family last month over a holiday weekend. As they wandered around the exhibits with the museum guide, Tom Kibblewhite, they spotted the safe.

Kibblewhite told the family what he tells all other guests: the 900kg (2,000lb) black box with a silver dial had remained closed for generations.

For years, the safe has confounded volunteers at the museum. The manufacturer was unable to provide advice on how to open its thick door. A locksmith suggested to the museum that years of inactivity might have slowed down the finicky gears, rendering it inoperable.

But Mills, who is “mechanically minded person”, asked whether he could give it a try. “[Kibblewhite] kept saying no one had opened it and that it was a mystery what was inside,’” Mills told the Guardian. “I thought this would be a great thing to do for a laugh for the kids. What a time capsule.”

After pressing his ear against the cool metal, he began spinning the dial. With numbers ranging from zero to 60, he turned clockwise three times to 20, counter-clockwise two times to 40, and then clockwise one time to 60.

He was astonished to hear a click. “I jumped up and told everyone I’m buying a lottery ticket,” he said.

Shocked and amused volunteers quickly gathered to see what treasure had remained hidden for more than three decades. What awaited them was a waiter’s order book and a pay slip, both dating from the late 1970s.

Despite Mills’s success, staff are taking no more chances. They’ve placed sticky tape over the pins, ensuring that the door won’t close again.

Mills did buy that lottery ticket: he won two dollars. “So I’m still working,” he said. “But maybe I’ll get a new line of work out of this.”