A couple ideas I've had along these lines both involve tightly controlling the possible approaches to my fort. Basically, my front gates have their usual defenses, and the path leading to the gates is long and narrow. VERY long. As in, like, half the map long. Causeways, tunnels, bridges, whatever, just so long as I know exactly where they're coming, and thus exactly where they'll be retreating.
When the goblins reach the real teeth of my defenses, they will have been going down this limited-access path for quite a ways, so when they break and run, they have a very long ways to travel along a path that I know for a fact that they'll take. At this point, there's two options:
1) The easier one is to have some spots where Marksdwarves can pop out on one side of a moat lining the access road. These spots would be placed in such a way as to make it a nice, short walk for the Marksdwarves, giving them plenty of time to get there before the goblins run off. Goblins attack, goblins break, goblins run, goblins suddenly find themselves in a shooting gallery.
2) The harder (and thus more Dwarfy) one involves changing the access road's layout mid-battle. At one point along the road, it splits into two for a ways. One of them is the normal road, the other is inaccessable and filled with an unholy number of traps. When the goblins get to my defenses, a lever or pressure plate flips some bridges (or floodgates or whatever), making the first (normal) branch inaccessable, and the other (trapped) part the only route out. Thus they have no choice but to follow the trapped path out.
For a quick, crude illustration:
FORT.....................
.
.........................
.
.........................
b +
. ^
. ^ <-NUMBER 2
. ^
b +
.........................
. ☺☺☺☺ <-NUMBER 1
.....................REST OF MAP
. = moat-lined road, causeway, elevated skyway, whatever
^ = trapped road
b = crossable bridge
+ = retracted bridge
☺ = End of a straight-line underground tunnel leading back to your Marksdwarves