The defendant could raise an "ineffective assistance of counsel" argument, asserting his counsel was incompetent and it prejudiced him. You can make that claim in your direct appeal, but for procedural reasons, defendants usually make them in separate petitions for writs of habeas corpus. That's not a lawsuit against the lawyer, though. Instead, it's a lawsuit seeking your freedom from the state.