Iv'e thought about this a little too but been too busy with beers that other people want me to brew.
I think there's 2 options, post fermentation and mash. I think the post fermentation would be the best way to go for the first time to see what they do to the beer.
when the beer has finished fermentation and the yeast are cleaning up all their byproducts it would be safe to add the cucumber straight to the beer. I wouldn't bother with the bag, just slice em up keep a lil skin on them and toss them in, and when you rack off, leave them behind.
when the yeast is in that final stage it becomes very hard for bacteria or other infections to get a foothold. There is very little sugars left for the bugs to feed on and the high competition with the yeast and the alcohol make it hostile for anything to grow (at least not at a fast rate)
Those cucumbers contain a good percentage of vitamins A, C and K, and the skin has fiber and minerals such as silica, potassium and magnesium. These minerals and vitamins would be the reason to toss the cucumber in the mash. added nutrients to make the yeast happy. Not sure how much will evaporate out during the boil but its defiantly worth a shot.
Another thing I was thinking was a little oven toasting to form some Melanoidins and residual sweetness that hopefully wont ferment out. going for that cucumber bread flavor.