Weierstrass simply observed that not every problem in the calculus of variations would have a solution. He considered the example $$D[y]=\int_{-1}^{1}x^2\left(\frac{d y}{dx}\right)^2dx\to \min,$$ where the functional $D[y]$ is minimized over continuous functions having piecewise continuous first derivatives in $[-1,1]$ and satisfying the boundary conditions $y(-1)=0$, $y(1)=1$. He proved that although there is a minimizing sequence $y_n=y_n(.)$ which makes $D[y_n]$ arbitrarily small, the minimal value of zero is never actually attained.
Weierstrass's example called into question the a priori validity of Dirichlet's principle. However, it it did not completely refute the specific applications of Dirichlet's principle to boundary value problems for Laplace's equation developed by Green, Dirichlet, Riemann and others. It simply implied that the particular result required by Riemann would need a formal proof, which Riemann had not provided. For that reason some people refer to this example as Weierstrass's critique rather than Weierstrass's counterexample.
The story is briefly discussed in "A History of Analysis" edited by Hans Niels Jahnke.