Deconvolution of two FIRs
I'm not sure why the problem occurs for you with the x22 example, but I believe the problem is because the deconvolution is not being performed over the right length.

Deconvolution of an FIR (inverting an FIR) requires, in general, convolution using an infinite duration impulse response.  So just using the default lengths in performing the deconvolution using an FFT might not generate the correct result.

I've implemented the same problem in R, but the last (additional) row of plots shows the results obtained if I do the deconvolution over a longer signal than the default. This generates the right results.



As you can see, my implementation generates bizarre results for the x21 example rather than the x22 example in yours.



R Code Below

x1 &lt;- c(0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0)
x21 &lt;- c(0,1,1,1,0)
x22 &lt;- c(0,1,1,1,0,0)
x23 &lt;- c(0,1,1,1,0,0,0)

my_conv &lt;- function(x,y)
{
  out_length &lt;- length(x)+length(y)-1
  x_pad &lt;- c(x,rep(0,out_length-length(x)))
  y_pad &lt;- c(y,rep(0,out_length-length(y)))

  z &lt;- Re(fft(fft(x_pad) * fft(y_pad),inverse=TRUE))

  return(z/out_length)
}

my_deconv &lt;- function(x,y, out_length=0)
{
  if (out_length == 0)
  {
    out_length &lt;- length(x)+length(y)-1
  }
  x_pad &lt;- c(x,rep(0,out_length-length(x)))
  y_pad &lt;- c(y,rep(0,out_length-length(y)))

  z &lt;- Re(fft(fft(x_pad) / fft(y_pad),inverse=TRUE))

  return(z/out_length)
}

par(mfrow=c(5,3))
plot(x1)
plot(x1)
plot(x1)
plot(x21)
plot(x22)
plot(x23)
y1 &lt;- my_conv(x1,x21)
plot(y1)
y2 &lt;- my_conv(x1,x22)
plot(y2)
y3 &lt;- my_conv(x1,x23)
plot(y3)
plot(my_deconv(y1,x1))
plot(my_deconv(y2,x1))
plot(my_deconv(y3,x1))
plot(my_deconv(y1,x1,50))
plot(my_deconv(y2,x1,50))
plot(my_deconv(y3,x1,50))