A Dalitz plot analysis of $B^0 to eta_c(1S) K^+pi^-$ decays is performed using data samples of $pp$ collisions collected with the LHCb detector at centre-of-mass energies of $sqrt{s}=7,~8$ and $13$ TeV, corresponding to a total integrated luminosity of $4.7~text{fb}^{-1}$. A satisfactory description of the data is obtained when including a contribution representing an exotic $eta_c(1S) pi^-$ resonant state. The significance of this exotic resonance is more than three standard deviations, while its mass and width are $4096 pm 20~^{+18}_{-22}$ MeV and $152 pm 58~^{+60}_{-35}$ MeV, respectively. The spin-parity assignments $J^P=0^+$ and $J^{P}=1^-$ are both consistent with the data. In addition, the first measurement of the $B^0 to eta_c(1S) K^+pi^-$ branching fraction is performed and gives $displaystyle mathcal{B}(B^0 to eta_c(1S) K^+pi^-) = (5.73 pm 0.24 pm 0.13 pm 0.66) times 10^{-4}$, where the first uncertainty is statistical, the second systematic, and the third is due to limited knowledge of external branching fractions.