Nonlinear perturbations of differential operators with nontrivial kernel and applications to third-order periodic boundary value problems