I'd say that certainly if you can see the underlying copper wire that it's a problem. Sure, it may work without a problem for years, but it's definitely not right, and it's a hazard. Even if the insulation is apparently intact, it's still compromised by the heat of the flame. I would have an electrician look at it if you're not comfortable fixing it yourself.
Most codes dictate that electrical cables be terminated within a junction box. A junction box is where a lightswitch or an outlet might be installed (among other things). So, you can replace a patch of cable, but its ends should be in a j-box, and the j-box should be accessible to the user (i.e., not buried under drywall).
Now, maybe it's just the external 'romex' sheathing that's been cooked, and you're seeing the individual wires withing (black, white, green, maybe red). That's more of a gray area for me... I'd have an electrician look at it either way.
Note: I'm not an electrician per se, but I've done lots of my own remodel work and have never failed an inspection. Good luck!