I presume you know that reduction of wheat consumption is a small part of a FODMAP diet. Many individuals don't have any problems with wheat but have difficulty with poorly absorbed carbohydrates such as fructose, sorbitol, etc. Have you tried reducing or eliminating foods particularly fruits with excess fructose?
The melatonin clinical study I referred to was designed to determined with melatonin would improve the sleep habits of IBSers with sleep disturbances. The hypothesis was a better night sleep might improve IBS symptoms. Instead they found that melatonin did not improve sleep measured using a polysomnography and a questionnaire. However, they did find a significant improvement in pain tolerance measured using rectal manometry to measure the pressure at which pain is experienced with increased pressure. Since this study was done the role of melatonin in controlling gut motility and sensation has become a lot clearer.
PS - a good night sleep might occur because your IBS was not as bad instead of a good night sleep making IBS better.
Good luck with your search
-------------------- STABLE: ♂, IBS-D 50+ years - Science of IBS