Transformations of infinitely divisible distributions via improper stochastic integrals