Wouldn't LSAT Technologies being tested at the moment be the most suitable in a vacuum, with telescopic/Caseless rounds this could solve the problem of radiation and temperature fluctuations on brass casing. The problem I can see is keeping the moving parts lubricated In those temperatures.
Apparently no Soyuz leaves the ground without a gun on board. Primary purpose is self defense after landing in the wilderness and waiting for the helo. Also for "special circumstances". As stated before Russia tested them. There are guns under Russian control on the International Sace Station (presumably for use upon landing if they have to bugout in the escape Soyuz, but available (and usable) in space.
"The triple-barreled gun can fire flares, shotgun shells, or rifle bullets, depending on how it's loaded. The gun and about 10 rounds for each barrel are carried in a triangle-shaped survival canister stowed next to the commander's couch. The gun's shoulder stock opens up into a machete for chopping firewood."
And the only way to lose heat is through radiation. Just look up what the ISS is doing to keep itself cool. All the heat has very little places to go, there's nothing to conduct it to. Space is cold, but it's also fairly empty. There's basically not a whole lot there that is cold.
So yeah, in space, cold is the least of your worries.