What you need is a special wood repair epoxy, or make your own.
G-flex is a good start. You need to find sawdust from the same wood that you are repairing, and use that to thicken the mixed epoxy to a paste-like consistency.
I would use a hole-saw to partially drill into the cap rail (followed by hand tools to dig it out) so that the repair looks like a plug
. Make sure you get all the affected wood out.
Epoxy can't stand UV, not even for a couple of days (will change color) so keep it covered until you're ready to varnish
it. If the cap rail isn't varnished, you need to make a plug of the same wood that goes in instead of the epoxy. I would prefer to do that anyway.