Yes, this can be done, but requires a little care with the fundamental group. First, let me tighten up your description; one is attaching the 2-handle to $S^1 \times B^3$ along a curve $\gamma$ in its boundary $S^1 \times S^2$. In order to get a contractible manifold, $\gamma$ should generate $\pi_1(S^1\times B^3) = \pi_1(S^1\times S^2)$. The point of this is to make sure that the resulting fundamental group is trivial. Such manifolds are often called Mazur manifolds (although the terminology is not universal.)

The key observation is that $S^1 \times B^3$ is the exterior of an unknotted disk in $B^4$. You could replace that with any disk D (with a slice knot K as boundary) but now we have to be more careful about the fundamental group. You want to require that $\gamma$ normally generate the fundamental group of $B^4 -nhd(D)$. If $\gamma$ is freely homotopic to a meridian of $S^3 - K$, then this will hold. In this case the manifold $W$ obtained by adding a 2-handle to $B^4 - nhd(D)$ is simply connected, and it's easy to check that its homology vanishes, so it will be contractible.

The boundary of the manifold built this way is obtained by surgery on $0$-surgery on $K$. Presumably one can find examples of this sort that aren't obtained by adding a 2-handle to $S^1\times B^3$.