I've heard that it's possible to hold the crankshaft still, for the purposes of unbolting the pulley, on a manual transmission vehicle without a special tool, by shifting it in the smallest gear (5th or 6th, depending on vehicle) because that gives the most resistance to power transfer. Is it a safe way to do it or is it a hack that could mess something up?
Yes, put it in the highest gear you can put it into if you have a manual transmission. This gives the greatest amount of resistance to the torque you'll put on the crank shaft bolt. At the same time, put your parking brake on for even better holding power. This should not cause any issue with the engine or drive train. I say this because in most cases the engine will put far more torque onto the drive train than you ever will loosening a crank shaft bolt.
Another way to do it you might consider is to wedge a long, flat tip screwdriver against the starter gear (if its available). This will take a second pair of hands, but it will work also (especially if you are doing the work on a vehicle with an automatic transmission).
The best way to get them off is by using an impact gun. Usually takes them off slick as snot: no fuss; no muss.
NOTE: You may want to ask about putting it back on in another question. Not a good idea to use the bolt to draw the harmonic balancer back on.