This is how I would do that (pseudo-code):
class Vector {
var float x;
var float y;
function Vector (float angle, float magnitude); // constructor
function add(Vector); // adds new vector to current vector
function angle(float new_angle); // returns or sets angle
function magnitude(float new_magnitude); // returns or sets magnitude
}
class Ship {
position = new Vector(0, 0);
velocity = new Vector(0, 0);
max_speed = 10;
}
function update() {
acceleration = impulse_key_pressed ? new Vector (ship.position.angle(), engine_power) : new Vector(0, 0);
ship.position.add(acceleration);
ship.position.add(asteroid_collision);
if (ship.velocity.magnitude() > ship.max_speed)
ship.velocity.magnitude(ship.velocity.magnitude() - 0.1);
}
Getting hit with an asteroid is just a one time addition of new acceleration to the current position. This acceleration is big enough to influence the current ship's velocity and increase it over its max speed. Afterwards the ship slows down gradually (by 0.1 of magnitude each update).
You can read up more on vectors e.g. in this answerthis answer.