I usually see it expressed as "40C" rather than "C40", but, yeah, I assume that's the "C rating". Essentially, "C" is the charge capacity of the device with the time divided out (so a 3700mAh battery would have C=3700mA). A "40C" battery means you can safely draw "40C" (or 40*3700mA or a whopping 148A). 40C is quite high - these packs are normally used in things like power tools, but RC cars/planes would also benefit from the high power availability. One can typically charge at 1/10th the discharge rating or 1C, whichever is higher. A typical discharge rating is more like 4-5C.
Chances are you can safely substitute a higher capacity Li-Po (not necessarily conventional Li-Ion) in discharge only. It may not drain it quite as far down as you'd like it to (early cutoff), but this isn't a huge deal and will in fact tend to lengthen the lifespan of the battery.
However, the charger may get confused. If the charger is external, this isn't a problem: just use a different charger suited to the new battery (available from the source of the battery, likely). If the charger is internal, you may have some problems with it not fully charging the battery and/or reducing lifespan of the battery, but it's not likely to be a safety hazard.
Be cautions substituting a convention Li-Ion for a Li-Po. The electrical behavior is subtly different and will probably confuse the charger. Again, if the charger is external, just get a suitable charger. It's not likely to be a safety hazard on discharge but could be. Discharge shouldn't be a big deal though again you may have early cut-off problems, and Li-Po is often discharged deeper than cell Li-Ion, so you may actually discharge too deeply and wreck the battery quickly. Do note that there are several subtly different cell-based Li-Ion chemistries, too, and depending on which one you sub in, you might get different behavior.
As for terminal mapping, you'll need to figure out what each one does. There's no real standard. Sometimes they are marked "+", "-", and "T". + is the pack + terminal, - is the pack - terminal (common), and T is the safety thermistor. If the battery only has two terminals, then it does not have a safety thermistor. Not all batteries have one, and it's not always used, especially on devices that don't have an integral charger.
There's also no real standard on the safety thermistor. Some use 1ks, some use 10ks, some use 100ks, and they'll all use various types (some are PTC, some NTC, all of them have different curves). This may confuse the charger and dischage device into either going into shutdown prematurely (possibly immediately) or may defeat the thermal safety entirely. Again, be careful.
Let me put safety this way: I'm a EE (Computer, but same idea) by trade. I pay special caution when working with 3 main things: CRT monitors (high voltage), line voltage AC (high instantaneous power capability), and lithium batteries (high instantaneous power and explosion risk). This should tell you something. These things have crazy energy density and can discharge fast enough to cause thin wires to VAPORIZE if the safeties are defeated. Be careful.