Are you sure the OG was accurate? Could you post the recipe?
I am pretty sure the OG was correct but honestly it was kind of low on my priority list so I could have been off some. Unfortunately I no longer have the exact recipe, or any of my notes for that matter because I left it on the counter and the wife thought it was trash and out it went. But it was a kit that consisted of 1 can malt extract (light), 1 bag of dry malt extract, 1 bag of bittering hops, 1 bag of finishing hops, and 1 packet of Wyeast German Ale 1007. I brought 3 gallons of water to a boil and added the malt, brought that back to a boil and added the bittering hops and boiled that for an hour adding the finishing hops for the last 5 mintues. I then used an ice bath to bring the temp down to 67 degrees and put the wort into the fermenter and then topped it off to 5 gallons. I mixed and aerated the wort and took some out to make my reading and then added the yeast.
Per your recall of ingredients and batch size above I think the OG for your brew is approximately 1.039 calculated as follows:
A can of malt extract is usually 3.3 lbs, but based on your estimate of an OG of 1.040, my educated guess is that you used alexander's LME which is a 4 lb can; average yield of LME is 37 gravity points per pound of extract (1.037 in a gallon of water with 1lb of LME); So, that is 37 x 4 = 148 gravity points from the LME alone.
I bag of DME I will assume this was a 1lb bag from a normal homebrew kit; yield is an average of 47 points per lb of DME resultin gin 47 gravity points from DME;
Total fermentables; 148 above plus 47 = 195 divided by 5 gallons of water = 39 or an OG of 1.039.
A FG of 1.022 means you got only 43% attenuation. For bottling homebrew, that is scary. In the future, I would first rouse the yeast by swirling the bucket/carboy and warming up the fermentation temperature if possible to room temp. If the gravity doesn't drop, I would rehydrate a pack of safale s-05 yeast and pour into fermenter to see if that gravity will drop further.