What I Do
What I do, as was told to me by a Radio Shack tech, was THE way of handling small engines and gears. Okay okay, I know Radio Shack is probably a tabboo around here, but, I was having trouble with gears splitting and I busted the motor in this little transmission I was working on.
Anyway.
The thing to do is much like jon said except you don't put the gear in a vice. This would make the gear junk and no good any more. So make a brace (for lack of a better name) out of a piece of scrap tin, about 3" square, and cut a grove from one side to the center that is just a bit wider than the shaft of the motor. Slide this brace on the shaft between the gear and the motor body. Then set it, motor down, on a vice, so the motor hangs free and the brace sits on top of the vices jaws. Then using a finnishing nail that is the same size or smaller than the motor shaft as a punch, and a small hammer, tap the shaft out of the gear. Sometimes I use an old pair of scissors for the brace depending on clearance requirements. With this technique you don't damage the motor or the gear.
To put the gear back on the shaft without damaging anything.
Put the gear on a hard flat surface (I have a little anvil) then line up the motor with the gear and, with a small hammer, tap on the back end of the motors shaft to seat the shaft into the gear. Most small motors have the shaft sticking out the back just a bit.
Do it this way and you will not have a problem with the brushes being knocked out of alignment by putting to much force on the motor housing.
I try to find brass gears to replace plastic ones. Brass don't split.
TrainClown