If you want to immediately delete it form the same terminal first you have to add the following to your ~/.bashrc file.
PROMPT_COMMAND='history -a'
and restart your terminal.
You can add it anywhere in .bashrc file .I have added as below along with other history related stuff.

Usually during a bash session the executed commands are not written into .bash_history until the session is terminated hence PROMPT_COMMAND='history -a'
enters the command then and there into .bash_history.
Now whenever you make mistake or error in a command and want to delete it then and there just execute the following
sed -i '$d' ~/.bash_history
and tada it would be deleted.
To make it simpler you can alias it to something more simpler and use it such as
alias rh ='sed -i '\''$d'\'' ~/.bash_history'
So executing rh
will remove the last executed command from history.
The above is temporary aliasing which only lasts for a session.To make it permanent or persistent add
alias rh = 'sed -i '\''$d'\'' ~/.bash_history'
to .bashrc
NOTE
There should not be any space on both sides of =
If You Dont Want to Alias then You could also do the following
Make a commad name rh
and place it in /bin
directory:
Open a file say rh
and paste following code, save and close:
sed -i '$d' ~/.bash_history
Make rh
executable and place it in /bin
directory:
chmod +x rh
sudo cp rh /bin
Now use rh
command to delete recent command from history.