The story originated from two separate pieces: "Another Man's Wife" and "A Jealous Husband" (published in 1848 in the journal "Notes of the Fatherland"). In preparing the 1859 two-volume collected works, the writer combined both in one story — "Another Man’s Wife and a Husband Under the Bed". The first part only slightly changed certain lines, while the second part is more significantly altered.
In his story, Dostoevsky utilized some techniques of the vaudeville genre, in particular the construction of the dialogues, replete with puns. The title of the story, too, resembles popular titles of the vaudeville 1830-1840s (e.g., Fyodor Koni's 1834 "Husband in the Fire, While His Wife On a Visit"). Dostoevsky continued to use these techniques in future works (for example, in "Uncle's Dream"). Subsequently, Dostoevsky gave a different, deeply psychological interpretation of the theme of the deceived husband, in the story The Eternal Husband (1870). (from Wikipedia)