In this paper we provide sufficient conditions for positive (semi)definiteness of sign-changing diagonal perturbations of positive semidefinite difference operators and their matrix representations, the Laplacian matrices of graphs. Our estimates arise from the discrete version of the Poincaré inequality and essentially depend on the algebraic connectivity of the underlying graph, i.e., the second smallest eigenvalue of the graph Laplacian matrix. We generalize our results to positive semidefinite matrices with simple zero eigenvalue and illustrate our results by numerical experiments and discuss the optimality of our assumptions.