Outspoken former prime minister Dr Mahathir Mohamad suffered a heart attack before he was hospitalised earlier in the week, doctors said.